Results 1 to 4 of 4

Thread: Form Message and Success View Newbe Question

  1. #1
    Join Date
    Apr 2005
    Posts
    29

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    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

  3. #3
    Join Date
    Apr 2005
    Posts
    19

    Default

    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

  4. #4
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

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

Similar Threads

  1. Replies: 9
    Last Post: Nov 1st, 2005, 10:36 PM
  2. Displaying a global form error
    By AndyAtHome in forum Web
    Replies: 1
    Last Post: Jun 26th, 2005, 02:40 PM
  3. Replies: 3
    Last Post: May 16th, 2005, 11:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •