Limitations
The AbstractWizardFormControllerhas some limitations that are important to understand
before you begin to use it. The Controllerreally only supports simple multipage work flows
that are essentially a single form spread across multiple pages. This Controllerwas not
designed to support arbitrary decision branching, and in no way can it handle a generic state
machine. For that, you should turn to Spring Web Flow, covered later in this book. With Spring
Web Flow, you can declaratively create arbitrarily complex work flows, allowing the user to
travel back and forth through the state machine.
To summarize, use AbstractWizardFormControllerwhen you want to split what otherwise
would have been a long form into multiple pages. Also, use the AbstractWizardFormController
only when you are populating a single command bean across multiple pages. For anything
more complex Spring Web Flow is your solution.
■CautionTheAbstractWizardFormControlleris for work flows with strict page progression. Use this
controller only for splitting a single form across multiple pages.
State Changes
This controller supports three different types of state changes:
- Page change: moving from one page to another, either backward (in the event of valida-
tion errors, for instance) or forward on success. - Cancel: exiting the wizard in mid–work flow, typically clearing the state of the wizard.
This state change is optional. - Finish: formally completing the work flow. This is the end state for the wizard.
By default, the Controllerknows which state to enter by examining different well-known
request parameters. You may change the heuristics for detecting a state change by overriding
the appropriate method (see Table 6-3).
Table 6-3.Wizard State Change
State Default Parameter Override Method
Page _targetXXX, where XXXequals the number of the next page view getTargetPage()
Cancel _cancel isCancelRequest()
Finish _finish isFinishRequest()
These parameters are normally included as hidden XHTML elements in the form. Each
form submission should contain only one of the above parameters. Their values don’t matter;
only the existence of the parameter is enough to trigger the state change.
CHAPTER 6 ■THE CONTROLLER MENAGERIE 177