Announcement Announcement Module
Collapse
No announcement yet.
mvc: POST-REDIRECT-GET Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • mvc: POST-REDIRECT-GET

    hi everyone,

    I'm using the spring MVC framework, and I'm wondering how to do this correctly. I have a website that uses an input form. When errors are found, that form has to be reloaded, when done the form shows a confirmation page showing mainly the same information.

    You could think of an order confirmation page in which the final details are entered, then when done submit is pressed and the order confirmation is shown.

    Now for parsing the orderform I use a SimpleFormController which nicely populates my model object and saves the order to the database and showing the confirmation view, however, the problem occurs when someone hits reload. The page would be resubmitted and another order placed (which is ofcourse not very desireable).

    Now an article on the serverside (http://www.theserverside.com/article...directAfterGet) said that the best solution was to post the data and redirect to the confirmation page. However, implementing this in spring MVC is not that simple. It requires me to overwrite the onSubmit. Besides that the model gets lost in the process and I'll have to request it again from the database. What would be a good way of handeling this posting pattern? Or are their alterantives or build in functions for this?

    Thanks,
    Vincent

  • #2
    I have a requirement to do the same thing: ask for data and then show a confirmation page. What I did was to have my controller extend AbstractWizardFormController, with page 0 being the form and page 1 being the confirmation page.

    Comment

    Working...
    X