Results 1 to 3 of 3

Thread: How to return to form view when form is in multiple views?

  1. #1

    Default How to return to form view when form is in multiple views?

    If you have a form on multiple pages that post to a particualr controller, how do you determine the view that posted the form so as to return to that view?

  2. #2

    Default

    Here is how I got around it, hope there is a better way.

    Code:
    <form action="$rc.getContextPath&#40;&#41;/cart/addtocart.htm" method="post" enctype="application/x-www-form-urlencoded" name="shopcart" onSubmit="document.shopcart.href.value=location.href;">
    
    <input type="hidden" name="href" value="">
    </form>

    In controller
    --------------------
    Code:
    return new ModelAndView&#40;new RedirectView&#40;RequestUtils.getStringParameter&#40;request, "href", "/index.htm"&#41;&#41;&#41;;

  3. #3
    Join Date
    Aug 2004
    Location
    Sydney
    Posts
    503

    Default

    AbstractWizardFormController is designed to handle this.

    It probably should be called AbstractMultiViewFormController since while it does contain the concept of Finish and Cancel, it also does *not* force you to make your view look like a wizard.

    e.g. you could make your view look like tabbed pages, or use other buttons to move between the different views.

    You use name="_target0", "_target1", "target2" (for pages 1,2,3, ...) in form input fields to tell the controller which view to show, and configure the view names in the spring config file via the "pages" property.

    Probably easiest to just read the source code for it but sounds like what you want.

Similar Threads

  1. Replies: 9
    Last Post: Nov 1st, 2005, 10:36 PM
  2. Odd behaviour when injecting TransactionTemplate
    By damon311 in forum Container
    Replies: 3
    Last Post: Jul 23rd, 2005, 11:21 AM
  3. Replies: 0
    Last Post: Jun 6th, 2005, 09:23 AM
  4. Content Provider vs View Model
    By Martin Kersten in forum Swing
    Replies: 21
    Last Post: Mar 10th, 2005, 02:25 PM
  5. Replies: 2
    Last Post: Sep 14th, 2004, 09:58 AM

Posting Permissions

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