java.lang.Objectorg.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.support.WebContentGenerator
org.springframework.web.servlet.mvc.AbstractController
org.springframework.web.servlet.mvc.BaseCommandController
org.springframework.web.servlet.mvc.AbstractFormController
org.springframework.web.servlet.mvc.AbstractWizardFormController
All Implemented Interfaces:
Controller, ServletContextAware, ApplicationContextAware
Direct Known Subclasses:
OrderFormController
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 ("_page") in order to properly handle usage of the back button in a browser: In this case, a submission will always contain 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.
Juergen - Hoeller25.04.2003 - | Field Summary | ||
|---|---|---|
| public static final String | PARAM_FINISH | Parameter triggering the finish action. Can be called from any wizard page! |
| public static final String | PARAM_CANCEL | Parameter triggering the cancel action. Can be called from any wizard page! |
| public static final String | PARAM_TARGET | Parameter specifying the target page, appending the page number to the name. |
| public static final String | PARAM_PAGE | Parameter specifying the current page as value. Not necessary on
form pages, but allows to properly handle usage of the back button.
|
| Fields inherited from org.springframework.web.servlet.mvc.BaseCommandController: |
|---|
| DEFAULT_COMMAND_NAME |
| Fields inherited from org.springframework.web.servlet.support.WebContentGenerator: |
|---|
| METHOD_GET, METHOD_HEAD, METHOD_POST |
| Fields inherited from org.springframework.context.support.ApplicationObjectSupport: |
|---|
| logger |
| Constructor: |
|---|
"sessionForm" is automatically turned on, "validateOnBinding" turned off, and "cacheSeconds" set to 0 by the base class (-> no caching for all form controllers). |
| Method from org.springframework.web.servlet.mvc.AbstractWizardFormController Summary: |
|---|
| getCurrentPage, getInitialPage, getInitialPage, getPageAttribute, getPageCount, getPageCount, getPageSessionAttributeName, getPageSessionAttributeName, getPages, getTargetPage, getTargetPage, getViewName, handleInvalidSubmit, isAllowDirtyBack, isAllowDirtyForward, isCancelRequest, isFinishRequest, isFormSubmission, onBindAndValidate, onBindAndValidate, postProcessPage, processCancel, processFinish, processFormSubmission, referenceData, referenceData, referenceData, setAllowDirtyBack, setAllowDirtyForward, setPageAttribute, setPages, showForm, showPage, validatePage, validatePage |
| Methods from org.springframework.web.servlet.mvc.AbstractFormController: |
|---|
| currentFormObject, formBackingObject, getCommand, getErrorsForNewForm, getFormSessionAttributeName, getFormSessionAttributeName, handleInvalidSubmit, handleRequestInternal, isBindOnNewForm, isFormSubmission, isSessionForm, onBindOnNewForm, onBindOnNewForm, processFormSubmission, referenceData, setBindOnNewForm, setSessionForm, showForm, showForm, showForm, showNewForm |
| Methods from org.springframework.web.servlet.mvc.AbstractController: |
|---|
| handleRequest, handleRequestInternal, isSynchronizeOnSession, setSynchronizeOnSession |
| Methods from org.springframework.web.servlet.support.WebContentGenerator: |
|---|
| applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader |
| Methods from org.springframework.web.context.support.WebApplicationObjectSupport: |
|---|
| getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext |
| Methods from org.springframework.context.support.ApplicationObjectSupport: |
|---|
| getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, requiredContextClass, setApplicationContext |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.springframework.web.servlet.mvc.AbstractWizardFormController Detail: |
|---|
The default implementation checks the page session attribute. Subclasses can override this for customized page determination. |
The default implementation returns 0 for first page. |
The default implementation delegates to #getInitialPage(HttpServletRequest) . |
|
Note that a concrete wizard form controller might override
#getPageCount(HttpServletRequest, Object) to determine
the page count dynamically. The default implementation of that extended
|
Can be overridden to dynamically adapt the page count. |
Default is an internal name, of no relevance to applications, as the form session attribute is not usually accessed directly. Can be overridden to use an application-specific attribute name, which allows other code to access the session attribute directly. |
The default implementation delegates to the #getPageSessionAttributeName() variant without arguments. |
Note that a concrete wizard form controller might override #getViewName(HttpServletRequest, Object, int) to determine the view name for each page dynamically. |
The default implementation examines "_target" parameter (e.g. "_target1"). Subclasses can override this for customized target page determination. |
The default implementation delegates to #getTargetPage(HttpServletRequest, int) . Subclasses can override this for customized target page determination. |
The default implementation takes the view name from the #getPages() array. Can be overridden to dynamically switch the page view or to return view names for dynamically defined pages. |
The default implementation for wizard form controllers simply shows the initial page of a new wizard form. If you want to show some "invalid submit" message, you need to override this method. |
|
|
By default, this method returns The parameter is recognized both when sent as a plain parameter ("_cancel") or when triggered by an image button ("_cancel.x"). |
By default, this method returns The parameter is recognized both when sent as a plain parameter ("_finish") or when triggered by an image button ("_finish.x"). |
|
|
Note: AbstractWizardFormController does not perform standand validation on binding but rather applies page-specific validation on processing the form submission. |
Only invoked when displaying another page or the same page again, not when finishing or cancelling. |
The default implementation throws a ServletException, saying that a cancel operation is not supported by this controller. Thus, you do not need to implement this template method if you do not support a cancel operation. Call |
Call You can call the #showPage method to return back to the wizard, in case of last-minute validation errors having been found that you would like to present to the user within the original wizard form. |
|
The default implementation returns |
|
The default implementation delegates to referenceData(HttpServletRequest, int). Subclasses can override this to set reference data used in the view. |
|
|
This will be necessary for single views rendering multiple view pages. It also allows for specifying the optional "_page" parameter. |
|
This can be overridden in subclasses, e.g. to prepare wizard-specific error views in case of an Exception. |
|
Implementations will typically call fine-granular validateXXX methods of this
instance's validator, combining them to validation of the corresponding pages.
The validator's default |
Implementations will typically call fine-granular |