Form controller for typical wizard-style workflows.
In contrast to classic forms, wizards have more than one form view page.
Therefore, there are various actions instead of one single submit action:
finish: trying to leave the wizard successfully, i.e. performing its
final action, and thus needing a valid state;
cancel: leaving the wizard without performing its final action, and
thus without regard to the validity of its current state;
page change: showing another wizard page, e.g. the next or previous
one, with regard to "dirty back" and "dirty forward".
Finish and cancel actions can be triggered by request parameters, named
PARAM_FINISH ("_finish") and PARAM_CANCEL ("_cancel"), ignoring parameter
values to allow for HTML buttons. The target page for page changes can be
specified by PARAM_TARGET, appending the page number to the parameter name
(e.g. "_target1"). The action parameters are recognized when triggered by
image buttons too (via "_finish.x", "_abort.x", or "_target1.x").
The current page number will be stored in the session. It can also be
specified as request parameter PARAM_PAGE, to properly handle usage of
the back button in a browser: In this case, a submission always contains
the correct page number, even if the user submitted from an old view.
The page can only be changed if it validates correctly, except if a
"dirty back" or "dirty forward" is allowed. At finish, all pages get
validated again to guarantee a consistent state.
Note that a validator's default validate method is not executed when using
this class! Rather, the validatePage implementation should call
special validateXXX methods that the validator needs to provide,
validating certain pieces of the object. These can be combined to validate
the elements of individual pages.
Note: Page numbering starts with 0, to be able to pass an array
consisting of the corresponding view names to the "pages" bean property.
In contrast to classic forms, wizards have more than one form view page. Therefore, there are various actions instead of one single submit action:
Finish and cancel actions can be triggered by request parameters, named PARAM_FINISH ("_finish") and PARAM_CANCEL ("_cancel"), ignoring parameter values to allow for HTML buttons. The target page for page changes can be specified by PARAM_TARGET, appending the page number to the parameter name (e.g. "_target1"). The action parameters are recognized when triggered by image buttons too (via "_finish.x", "_abort.x", or "_target1.x").
The current page number will be stored in the session. It can also be specified as request parameter PARAM_PAGE, to properly handle usage of the back button in a browser: In this case, a submission always contains the correct page number, even if the user submitted from an old view.
The page can only be changed if it validates correctly, except if a "dirty back" or "dirty forward" is allowed. At finish, all pages get validated again to guarantee a consistent state.
Note that a validator's default validate method is not executed when using this class! Rather, the
validatePageimplementation should call specialvalidateXXXmethods that the validator needs to provide, validating certain pieces of the object. These can be combined to validate the elements of individual pages.Note: Page numbering starts with 0, to be able to pass an array consisting of the corresponding view names to the "pages" bean property.