Announcement Announcement Module
Collapse
No announcement yet.
Form Message and Success View Newbe Question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Form Message and Success View Newbe Question

    I'm using a SimpleFormController to handle basic forms. After I hit the submit button, I'd like to do one of two things (not sure which one yet).

    1. After I "Submit" I'd like to recall the udpate form and display an "Update Successful" message. The problem seems to be, however, is that all "responses" passed back to the form belong to the "command" class. So what I'd like to do is somehow add a message to the http response and pass it back to the calling JSP form.

    Or.

    2. Return to the "Success" view with data populated. I can currently redirect to that form, but the success view is not populated with any data. After going through the code with my debugger it appears that neither ModelAndView(...) nor formBackingObject(...) are called. So what I'm going to is an empty page. What I'd like is to call the ModelAndView equivilent and return to the form.

    Either of these to methods would work for me, but I don't know how to implement either solution. Any help would be appreciated.

  • #2
    After I "Submit" I'd like to recall the udpate form and display an "Update Successful" message
    You can do something like this:
    Controller
    Code:
            Map model = new HashMap();
            model.put("saveSuccessful", new Boolean(true));
            return showForm(request, response, errors, model);
    JSP
    Code:
    <c&#58;if test="$&#123;saveSuccessful&#125;"><fmt&#58;message key="saveSuccessful"/></c&#58;if>
    messages.properties
    Code:
    saveSuccessful=Save/Update was successful

    Comment


    • #3
      Hi,

      I don't see a method call

      Code:
      showForm&#40;request, response, errors, &#91;b&#93;model&#91;/b&#93;&#41;;
      but I put the parameter on the request object as such:

      Code:
      request.setAttribute&#40;"myValue", value&#41;;
      return showForm&#40;request, response, errors&#41;;
      Regards,
      Stefan

      Comment


      • #4
        I don't see a method call...showForm(request, response, errors, model);
        It's in the API here...showForm(request, response, errors, model)

        Comment

        Working...
        X