|
|
Multi-page forms in Spring 3.0.X
I need to implement a multi-page form using Spring 3.0.x.
My first inclination was to use AbstractWizardFormController but I notice that it is deprecated now.
Can anyone tell me what is the recommended way to implement forms that span multiple pages. My main concern is that the command objects scope will survive from request to request.
I realize that Spring Webflow would be one way of achieving this but I am hesitant to go that route right now.
I seem to recall some talk of a conversation scope being proposed in Spring 3?
This is what Spring WebFlow is for. You can use it as part of your standard Spring MVC application, by mapping a particular request to a webflow. See the the quot;spring-travelquot; application for a very good example:
svn/...samples/travel
I understand that is what Spring Webflow is for.
However, I am trying to refactor an 'in production' application and wanted to see if there is a more simple approach to adopt 'flow' or 'conversation' scope with Spring MVC.
We do intend to introduce webflow to our stack but with the complexity of the object model I am dealing with in this problem it may take some time to develop the expertise.
BTW, the conversational support is due for 3.1 (so it's not available yet) and even there, Webflow would be the natural way to handle this kind of thing... Webflow can be fit into an MVC app with ease..
My point is that there is no added complexity to the rest of your application in incorporating webflow. Take a look at how it is done in the sample application. It is, overall, a Spring MVC application, and one of the requests is simply mapped to a flow rather than a regular Spring MVC controller. So, you'd have to add the SWF jar dependencies to your app. No big deal. You don't need to use Tiles, etc. - as in the sample app. Just view your flow (for your quot;multi-page formquot;) as another quot;controllerquot;. No changes to your existing application. Just, instead of implementing a messy home-grown controllers/UI solution, you will have one extra flow configuration file (that, essentially, consolidates all your form conversation and persistence management) and a couple of SWF-related beans in your MVC root context configuration. You probably won't have to write any additional Java classes for that. (You can call your service method from the EL in the flow definition file.) |
|