PDA

View Full Version : AbstractWizardFormController and Dynamic Lists


elemur
Feb 10th, 2006, 02:45 PM
Hi,

I'm not sure how I should best handle this, but I have an AbstractWizardFormController that mostly is a normal sort of multi-page entry/validation process. However, in the middle of the process the user is allowed to search for an item, and must choose an item from the list of results.

The goal is that they could click on the item they want, and be able to continue the wizard process.

The wizard uses POST pages, but when I make a link with the list entry and a submit target reference, it seems to start the wizard over again, rather than continuing to the next page.

Is there a way to easily handle this list results selection mid-wizard?

thanks!

dhewitt
Feb 10th, 2006, 03:34 PM
The issue is that Spring's form controllers by default treat GET requests as an instruction to start the controller at the beginning (ie show the form entry page in a SimpleFormController) and only perform binding and validation on POSTs. You can modify this behaviour by overriding the isFormSubmission method. So in your example, you could return true from that method if the request is a POST *or* if a parameter named 'id' is present. That way, if you issue a GET by clicking a link that specifies an id parameter, the wizard will handle it as if it were a POST.

elemur
Feb 10th, 2006, 04:45 PM
Interesting.. it never occured to me to override that method.

I did that, and I now allow GET in a very specific case, and otherwise leave the behavior standard, and it works great now.

Thanks for your help!