Announcement Announcement Module
Collapse
No announcement yet.
EXTJS 4 and SpringMVC 3.1 form panel submission, Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • EXTJS 4 and SpringMVC 3.1 form panel submission,

    I am new to ExtJs and SpringMVC 3.1 framework.

    I have created the EXTjs form panel with two fields, When I submit that form it is invoking the spring controller and doing necessary action.

    But the problem here is that my springmvc controller returns MAV object back to EXTJS, which is not displaying on the page. When I see the firebug's XHR response contains the MAV object from the spring action class, which is not displaying it on UI.

    I think the problem is EXTJS Form panel submits AJAX request. If this is the case please help me on how to proceed.

    Code Sample:
    A). EXTJS submit form, to the url : 'save.action'
    <br>
    Ext.create('Ext.form.Panel', { ...............
    <br> buttons : [{
    <br> text : 'Save',
    <br> type : 'submit',
    <br> handler : function() {
    <br> var form = Ext.getCmp('userForm').getForm();
    <br> if (form.isValid())
    <br> form.submit({
    <br> waitMsg : 'Loading...',
    <br> url : 'save.action',
    <br> method : 'POST'
    <br> });
    <br> }
    <br> }]
    <br> });

    B). Spring Action method

    @RequestMapping(value="/save.action", method = RequestMethod.POST) <br>
    public ModelAndView save(@Valid @ModelAttribute User user, BindingResult result) {<br>
    userService.save(user)<br>
    Map<String, Object> data = new HashMap<String, Object>();<br>
    data.put("success",Boolean.TRUE);<br>
    return new ModelAndView("/user/list", data)<br>
    }<br>

    C). /user/list.jsp has just a string called 'LIST'. so the firrbugs's XHR response shows LIST. It's good upto this point

    Now the problem here is that the newly rendered page /user/list.jsp is not showing it on the browser.

    expected result:
    1). Submit EXTJS Form Panel. (create user)
    2). Perform action and returns MAV contains view and model (execute save())
    3). should display user list page .

    Could someone please give me the solution on how to handle this situation. Thanks in Advance
Working...
X