org.springframework.web.servlet.mvc
Class AbstractWizardFormController

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.support.WebContentGenerator
              extended by org.springframework.web.servlet.mvc.AbstractController
                  extended by org.springframework.web.servlet.mvc.BaseCommandController
                      extended by org.springframework.web.servlet.mvc.AbstractFormController
                          extended by org.springframework.web.servlet.mvc.AbstractWizardFormController
All Implemented Interfaces:
ApplicationContextAware, ServletContextAware, Controller

Deprecated. as of Spring 3.0, in favor of annotated controllers

@Deprecated
public abstract class AbstractWizardFormController
extends AbstractFormController

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 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(java.lang.Object, org.springframework.validation.Errors, int, boolean) 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.

Since:
25.04.2003
Author:
Juergen Hoeller
See Also:
setPages(java.lang.String[]), validatePage(java.lang.Object, org.springframework.validation.Errors, int, boolean), processFinish(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException), processCancel(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException)

Field Summary
static java.lang.String PARAM_CANCEL
          Deprecated. Parameter triggering the cancel action.
static java.lang.String PARAM_FINISH
          Deprecated. Parameter triggering the finish action.
static java.lang.String PARAM_PAGE
          Deprecated. Parameter specifying the current page as value.
static java.lang.String PARAM_TARGET
          Deprecated. Parameter specifying the target page, appending the page number to the name.
 
Fields inherited from class org.springframework.web.servlet.mvc.BaseCommandController
DEFAULT_COMMAND_NAME
 
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator
METHOD_GET, METHOD_HEAD, METHOD_POST
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
AbstractWizardFormController()
          Deprecated. Create a new AbstractWizardFormController.
 
Method Summary
protected  int getCurrentPage(javax.servlet.http.HttpServletRequest request)
          Deprecated. Return the current page number.
protected  int getInitialPage(javax.servlet.http.HttpServletRequest request)
          Deprecated. Return the initial page of the wizard, that is, the page shown at wizard startup.
protected  int getInitialPage(javax.servlet.http.HttpServletRequest request, java.lang.Object command)
          Deprecated. Return the initial page of the wizard, that is, the page shown at wizard startup.
 java.lang.String getPageAttribute()
          Deprecated. Return the name of the page attribute in the model.
protected  int getPageCount()
          Deprecated. Return the number of wizard pages.
protected  int getPageCount(javax.servlet.http.HttpServletRequest request, java.lang.Object command)
          Deprecated. Return the page count for this wizard form controller.
 java.lang.String[] getPages()
          Deprecated. Return the wizard pages, i.e.
protected  java.lang.String getPageSessionAttributeName()
          Deprecated. Return the name of the HttpSession attribute that holds the page object for this wizard form controller.
protected  java.lang.String getPageSessionAttributeName(javax.servlet.http.HttpServletRequest request)
          Deprecated. Return the name of the HttpSession attribute that holds the page object for this wizard form controller.
protected  int getTargetPage(javax.servlet.http.HttpServletRequest request, int currentPage)
          Deprecated. Return the target page specified in the request.
protected  int getTargetPage(javax.servlet.http.HttpServletRequest request, java.lang.Object command, Errors errors, int currentPage)
          Deprecated. Return the target page specified in the request.
protected  java.lang.String getViewName(javax.servlet.http.HttpServletRequest request, java.lang.Object command, int page)
          Deprecated. Return the name of the view for the specified page of this wizard form controller.
protected  ModelAndView handleInvalidSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Deprecated. Handle an invalid submit request, e.g.
 boolean isAllowDirtyBack()
          Deprecated. Return whether "dirty back" is allowed.
 boolean isAllowDirtyForward()
          Deprecated. Return whether "dirty forward" is allowed.
protected  boolean isCancelRequest(javax.servlet.http.HttpServletRequest request)
          Deprecated. Determine whether the incoming request is a request to cancel the processing of the current form.
protected  boolean isFinishRequest(javax.servlet.http.HttpServletRequest request)
          Deprecated. Determine whether the incoming request is a request to finish the processing of the current form.
protected  boolean isFormSubmission(javax.servlet.http.HttpServletRequest request)
          Deprecated. Consider an explicit finish or cancel request as a form submission too.
protected  void onBindAndValidate(javax.servlet.http.HttpServletRequest request, java.lang.Object command, BindException errors)
          Deprecated. Calls page-specific onBindAndValidate method.
protected  void onBindAndValidate(javax.servlet.http.HttpServletRequest request, java.lang.Object command, BindException errors, int page)
          Deprecated. Callback for custom post-processing in terms of binding and validation.
protected  void postProcessPage(javax.servlet.http.HttpServletRequest request, java.lang.Object command, Errors errors, int page)
          Deprecated. Post-process the given page after binding and validation, potentially updating its command object.
protected  ModelAndView processCancel(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object command, BindException errors)
          Deprecated. Template method for processing the cancel action of this wizard.
protected abstract  ModelAndView processFinish(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object command, BindException errors)
          Deprecated. Template method for processing the final action of this wizard.
protected  ModelAndView processFormSubmission(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object command, BindException errors)
          Deprecated. Apply wizard workflow: finish, cancel, page change.
protected  java.util.Map referenceData(javax.servlet.http.HttpServletRequest request, int page)
          Deprecated. Create a reference data map for the given request, consisting of bean name/bean instance pairs as expected by ModelAndView.
protected  java.util.Map referenceData(javax.servlet.http.HttpServletRequest request, java.lang.Object command, Errors errors)
          Deprecated. Calls page-specific referenceData method.
protected  java.util.Map referenceData(javax.servlet.http.HttpServletRequest request, java.lang.Object command, Errors errors, int page)
          Deprecated. Create a reference data map for the given request, consisting of bean name/bean instance pairs as expected by ModelAndView.
 void setAllowDirtyBack(boolean allowDirtyBack)
          Deprecated. Set if "dirty back" is allowed, that is, if moving to a former wizard page is allowed in case of validation errors for the current page.
 void setAllowDirtyForward(boolean allowDirtyForward)
          Deprecated. Set if "dirty forward" is allowed, that is, if moving to a later wizard page is allowed in case of validation errors for the current page.
 void setPageAttribute(java.lang.String pageAttribute)
          Deprecated. Set the name of the page attribute in the model, containing an Integer with the current page number.
 void setPages(java.lang.String[] pages)
          Deprecated. Set the wizard pages, i.e.
protected  ModelAndView showForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, BindException errors)
          Deprecated. Show the first page as form view.
protected  ModelAndView showPage(javax.servlet.http.HttpServletRequest request, BindException errors, int page)
          Deprecated. Prepare the form model and view, including reference and error data, for the given page.
protected  void validatePage(java.lang.Object command, Errors errors, int page)
          Deprecated. Template method for custom validation logic for individual pages.
protected  void validatePage(java.lang.Object command, Errors errors, int page, boolean finish)
          Deprecated. Template method for custom validation logic for individual pages.
 
Methods inherited from class org.springframework.web.servlet.mvc.AbstractFormController
currentFormObject, formBackingObject, getCommand, getErrorsForNewForm, getFormSessionAttributeName, getFormSessionAttributeName, handleRequestInternal, isBindOnNewForm, isSessionForm, onBindOnNewForm, onBindOnNewForm, setBindOnNewForm, setSessionForm, showForm, showForm, showNewForm
 
Methods inherited from class org.springframework.web.servlet.mvc.BaseCommandController
bindAndValidate, checkCommand, createBinder, createCommand, getBindingErrorProcessor, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getValidator, getValidators, getWebBindingInitializer, initApplicationContext, initBinder, isValidateOnBinding, onBind, onBind, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, setWebBindingInitializer, suppressBinding, suppressValidation, suppressValidation, suppressValidation, useDirectFieldAccess
 
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
 
Methods inherited from class 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 inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_FINISH

public static final java.lang.String PARAM_FINISH
Deprecated. 
Parameter triggering the finish action. Can be called from any wizard page!

See Also:
Constant Field Values

PARAM_CANCEL

public static final java.lang.String PARAM_CANCEL
Deprecated. 
Parameter triggering the cancel action. Can be called from any wizard page!

See Also:
Constant Field Values

PARAM_TARGET

public static final java.lang.String PARAM_TARGET
Deprecated. 
Parameter specifying the target page, appending the page number to the name.

See Also:
Constant Field Values

PARAM_PAGE

public static final java.lang.String PARAM_PAGE
Deprecated. 
Parameter specifying the current page as value. Not necessary on form pages, but allows to properly handle usage of the back button.

See Also:
setPageAttribute(java.lang.String), Constant Field Values
Constructor Detail

AbstractWizardFormController

public AbstractWizardFormController()
Deprecated. 
Create a new AbstractWizardFormController.

"sessionForm" is automatically turned on, "validateOnBinding" turned off, and "cacheSeconds" set to 0 by the base class (-> no caching for all form controllers).

Method Detail

setPages

public final void setPages(java.lang.String[] pages)
Deprecated. 
Set the wizard pages, i.e. the view names for the pages. The array index is interpreted as page number.

Parameters:
pages - view names for the pages

getPages

public final java.lang.String[] getPages()
Deprecated. 
Return the wizard pages, i.e. the view names for the pages. The array index corresponds to the page number.

Note that a concrete wizard form controller might override getViewName(HttpServletRequest, Object, int) to determine the view name for each page dynamically.

See Also:
getViewName(javax.servlet.http.HttpServletRequest, Object, int)

getPageCount

protected final int getPageCount()
Deprecated. 
Return the number of wizard pages. Useful to check whether the last page has been reached.

Note that a concrete wizard form controller might override getPageCount(HttpServletRequest, Object) to determine the page count dynamically. The default implementation of that extended getPageCount variant returns the static page count as determined by this getPageCount() method.

See Also:
getPageCount(javax.servlet.http.HttpServletRequest, Object)

setPageAttribute

public final void setPageAttribute(java.lang.String pageAttribute)
Deprecated. 
Set the name of the page attribute in the model, containing an Integer with the current page number.

This will be necessary for single views rendering multiple view pages. It also allows for specifying the optional "_page" parameter.

Parameters:
pageAttribute - name of the page attribute
See Also:
PARAM_PAGE

getPageAttribute

public final java.lang.String getPageAttribute()
Deprecated. 
Return the name of the page attribute in the model.


setAllowDirtyBack

public final void setAllowDirtyBack(boolean allowDirtyBack)
Deprecated. 
Set if "dirty back" is allowed, that is, if moving to a former wizard page is allowed in case of validation errors for the current page.

Parameters:
allowDirtyBack - if "dirty back" is allowed

isAllowDirtyBack

public final boolean isAllowDirtyBack()
Deprecated. 
Return whether "dirty back" is allowed.


setAllowDirtyForward

public final void setAllowDirtyForward(boolean allowDirtyForward)
Deprecated. 
Set if "dirty forward" is allowed, that is, if moving to a later wizard page is allowed in case of validation errors for the current page.

Parameters:
allowDirtyForward - if "dirty forward" is allowed

isAllowDirtyForward

public final boolean isAllowDirtyForward()
Deprecated. 
Return whether "dirty forward" is allowed.


onBindAndValidate

protected final void onBindAndValidate(javax.servlet.http.HttpServletRequest request,
                                       java.lang.Object command,
                                       BindException errors)
                                throws java.lang.Exception
Deprecated. 
Calls page-specific onBindAndValidate method.

Overrides:
onBindAndValidate in class BaseCommandController
Parameters:
request - current HTTP request
command - the command object, still allowing for further binding
errors - validation errors holder, allowing for additional custom validation
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
BaseCommandController.bindAndValidate(javax.servlet.http.HttpServletRequest, java.lang.Object), Errors

onBindAndValidate

protected void onBindAndValidate(javax.servlet.http.HttpServletRequest request,
                                 java.lang.Object command,
                                 BindException errors,
                                 int page)
                          throws java.lang.Exception
Deprecated. 
Callback for custom post-processing in terms of binding and validation. Called on each submit, after standard binding but before page-specific validation of this wizard form controller.

Note: AbstractWizardFormController does not perform standand validation on binding but rather applies page-specific validation on processing the form submission.

Parameters:
request - current HTTP request
command - bound command
errors - Errors instance for additional custom validation
page - current wizard page
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
BaseCommandController.bindAndValidate(javax.servlet.http.HttpServletRequest, java.lang.Object), processFormSubmission(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException), Errors

isFormSubmission

protected boolean isFormSubmission(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Consider an explicit finish or cancel request as a form submission too.

Overrides:
isFormSubmission in class AbstractFormController
Parameters:
request - current HTTP request
Returns:
if the request represents a form submission
See Also:
isFinishRequest(javax.servlet.http.HttpServletRequest), isCancelRequest(javax.servlet.http.HttpServletRequest)

referenceData

protected final java.util.Map referenceData(javax.servlet.http.HttpServletRequest request,
                                            java.lang.Object command,
                                            Errors errors)
                                     throws java.lang.Exception
Deprecated. 
Calls page-specific referenceData method.

Overrides:
referenceData in class AbstractFormController
Parameters:
request - current HTTP request
command - form object with request parameters bound onto it
errors - validation errors holder
Returns:
a Map with reference data entries, or null if none
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
ModelAndView

referenceData

protected java.util.Map referenceData(javax.servlet.http.HttpServletRequest request,
                                      java.lang.Object command,
                                      Errors errors,
                                      int page)
                               throws java.lang.Exception
Deprecated. 
Create a reference data map for the given request, consisting of bean name/bean instance pairs as expected by ModelAndView.

The default implementation delegates to referenceData(HttpServletRequest, int). Subclasses can override this to set reference data used in the view.

Parameters:
request - current HTTP request
command - form object with request parameters bound onto it
errors - validation errors holder
page - current wizard page
Returns:
a Map with reference data entries, or null if none
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
referenceData(HttpServletRequest, int), ModelAndView

referenceData

protected java.util.Map referenceData(javax.servlet.http.HttpServletRequest request,
                                      int page)
                               throws java.lang.Exception
Deprecated. 
Create a reference data map for the given request, consisting of bean name/bean instance pairs as expected by ModelAndView.

The default implementation returns null. Subclasses can override this to set reference data used in the view.

Parameters:
request - current HTTP request
page - current wizard page
Returns:
a Map with reference data entries, or null if none
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
ModelAndView

showForm

protected ModelAndView showForm(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response,
                                BindException errors)
                         throws java.lang.Exception
Deprecated. 
Show the first page as form view.

This can be overridden in subclasses, e.g. to prepare wizard-specific error views in case of an Exception.

Specified by:
showForm in class AbstractFormController
Parameters:
request - current HTTP request
response - current HTTP response
errors - validation errors holder
Returns:
the prepared form view, or null if handled directly
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
AbstractFormController.showForm(HttpServletRequest, BindException, String), Errors, BindException.getModel(), AbstractFormController.referenceData(HttpServletRequest, Object, Errors), SimpleFormController.setFormView(java.lang.String)

showPage

protected final ModelAndView showPage(javax.servlet.http.HttpServletRequest request,
                                      BindException errors,
                                      int page)
                               throws java.lang.Exception
Deprecated. 
Prepare the form model and view, including reference and error data, for the given page. Can be used in processFinish(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException) implementations, to show the corresponding page in case of validation errors.

Parameters:
request - current HTTP request
errors - validation errors holder
page - number of page to show
Returns:
the prepared form view
Throws:
java.lang.Exception - in case of invalid state or arguments

getPageCount

protected int getPageCount(javax.servlet.http.HttpServletRequest request,
                           java.lang.Object command)
Deprecated. 
Return the page count for this wizard form controller. The default implementation delegates to getPageCount().

Can be overridden to dynamically adapt the page count.

Parameters:
request - current HTTP request
command - the command object as returned by formBackingObject
Returns:
the current page count
See Also:
getPageCount()

getViewName

protected java.lang.String getViewName(javax.servlet.http.HttpServletRequest request,
                                       java.lang.Object command,
                                       int page)
Deprecated. 
Return the name of the view for the specified page of this wizard form controller.

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.

Parameters:
request - current HTTP request
command - the command object as returned by formBackingObject
page - the current page number
Returns:
the current page count
See Also:
getPageCount()

getInitialPage

protected int getInitialPage(javax.servlet.http.HttpServletRequest request,
                             java.lang.Object command)
Deprecated. 
Return the initial page of the wizard, that is, the page shown at wizard startup.

The default implementation delegates to getInitialPage(HttpServletRequest).

Parameters:
request - current HTTP request
command - the command object as returned by formBackingObject
Returns:
the initial page number
See Also:
getInitialPage(HttpServletRequest), AbstractFormController.formBackingObject(javax.servlet.http.HttpServletRequest)

getInitialPage

protected int getInitialPage(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Return the initial page of the wizard, that is, the page shown at wizard startup.

The default implementation returns 0 for first page.

Parameters:
request - current HTTP request
Returns:
the initial page number

getPageSessionAttributeName

protected java.lang.String getPageSessionAttributeName(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Return the name of the HttpSession attribute that holds the page object for this wizard form controller.

The default implementation delegates to the getPageSessionAttributeName() variant without arguments.

Parameters:
request - current HTTP request
Returns:
the name of the form session attribute, or null if not in session form mode
See Also:
getPageSessionAttributeName(javax.servlet.http.HttpServletRequest), AbstractFormController.getFormSessionAttributeName(javax.servlet.http.HttpServletRequest), HttpSession.getAttribute(java.lang.String)

getPageSessionAttributeName

protected java.lang.String getPageSessionAttributeName()
Deprecated. 
Return the name of the HttpSession attribute that holds the page object for this wizard form controller.

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.

Returns:
the name of the page session attribute
See Also:
AbstractFormController.getFormSessionAttributeName(javax.servlet.http.HttpServletRequest), HttpSession.getAttribute(java.lang.String)

handleInvalidSubmit

protected ModelAndView handleInvalidSubmit(javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws java.lang.Exception
Deprecated. 
Handle an invalid submit request, e.g. when in session form mode but no form object was found in the session (like in case of an invalid resubmit by the browser).

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.

Overrides:
handleInvalidSubmit in class AbstractFormController
Parameters:
request - current HTTP request
response - current HTTP response
Returns:
a prepared view, or null if handled directly
Throws:
java.lang.Exception - in case of errors
See Also:
AbstractFormController.showNewForm(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), AbstractFormController.setBindOnNewForm(boolean)

processFormSubmission

protected final ModelAndView processFormSubmission(javax.servlet.http.HttpServletRequest request,
                                                   javax.servlet.http.HttpServletResponse response,
                                                   java.lang.Object command,
                                                   BindException errors)
                                            throws java.lang.Exception
Deprecated. 
Apply wizard workflow: finish, cancel, page change.

Specified by:
processFormSubmission in class AbstractFormController
Parameters:
request - current servlet request
response - current servlet response
command - form object with request parameters bound onto it
errors - holder without errors (subclass can add errors if it wants to)
Returns:
the prepared model and view, or null
Throws:
java.lang.Exception - in case of errors
See Also:
AbstractFormController.handleRequestInternal(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse), AbstractFormController.isFormSubmission(javax.servlet.http.HttpServletRequest), AbstractFormController.showForm(HttpServletRequest, HttpServletResponse, BindException), Errors, BindException.getModel()

getCurrentPage

protected int getCurrentPage(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Return the current page number. Used by processFormSubmission(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException).

The default implementation checks the page session attribute. Subclasses can override this for customized page determination.

Parameters:
request - current HTTP request
Returns:
the current page number
See Also:
getPageSessionAttributeName()

isFinishRequest

protected boolean isFinishRequest(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Determine whether the incoming request is a request to finish the processing of the current form.

By default, this method returns true if a parameter matching the "_finish" key is present in the request, otherwise it returns false. Subclasses may override this method to provide custom logic to detect a finish request.

The parameter is recognized both when sent as a plain parameter ("_finish") or when triggered by an image button ("_finish.x").

Parameters:
request - current HTTP request
Returns:
whether the request indicates to finish form processing
See Also:
PARAM_FINISH

isCancelRequest

protected boolean isCancelRequest(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Determine whether the incoming request is a request to cancel the processing of the current form.

By default, this method returns true if a parameter matching the "_cancel" key is present in the request, otherwise it returns false. Subclasses may override this method to provide custom logic to detect a cancel request.

The parameter is recognized both when sent as a plain parameter ("_cancel") or when triggered by an image button ("_cancel.x").

Parameters:
request - current HTTP request
Returns:
whether the request indicates to cancel form processing
See Also:
PARAM_CANCEL

getTargetPage

protected int getTargetPage(javax.servlet.http.HttpServletRequest request,
                            java.lang.Object command,
                            Errors errors,
                            int currentPage)
Deprecated. 
Return the target page specified in the request.

The default implementation delegates to getTargetPage(HttpServletRequest, int). Subclasses can override this for customized target page determination.

Parameters:
request - current HTTP request
command - form object with request parameters bound onto it
errors - validation errors holder
currentPage - the current page, to be returned as fallback if no target page specified
Returns:
the page specified in the request, or current page if not found
See Also:
getTargetPage(HttpServletRequest, int)

getTargetPage

protected int getTargetPage(javax.servlet.http.HttpServletRequest request,
                            int currentPage)
Deprecated. 
Return the target page specified in the request.

The default implementation examines "_target" parameter (e.g. "_target1"). Subclasses can override this for customized target page determination.

Parameters:
request - current HTTP request
currentPage - the current page, to be returned as fallback if no target page specified
Returns:
the page specified in the request, or current page if not found
See Also:
PARAM_TARGET

validatePage

protected void validatePage(java.lang.Object command,
                            Errors errors,
                            int page,
                            boolean finish)
Deprecated. 
Template method for custom validation logic for individual pages. The default implementation calls validatePage(Object, Errors, int).

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 validate method will not be called by a wizard form controller!

Parameters:
command - form object with the current wizard state
errors - validation errors holder
page - number of page to validate
finish - whether this method is called during final revalidation on finish (else, it is called for validating the current page)
See Also:
validatePage(Object, Errors, int), Validator.validate(java.lang.Object, org.springframework.validation.Errors)

validatePage

protected void validatePage(java.lang.Object command,
                            Errors errors,
                            int page)
Deprecated. 
Template method for custom validation logic for individual pages. The default implementation is empty.

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 validate method will not be called by a wizard form controller!

Parameters:
command - form object with the current wizard state
errors - validation errors holder
page - number of page to validate
See Also:
Validator.validate(java.lang.Object, org.springframework.validation.Errors)

postProcessPage

protected void postProcessPage(javax.servlet.http.HttpServletRequest request,
                               java.lang.Object command,
                               Errors errors,
                               int page)
                        throws java.lang.Exception
Deprecated. 
Post-process the given page after binding and validation, potentially updating its command object. The passed-in request might contain special parameters sent by the page.

Only invoked when displaying another page or the same page again, not when finishing or cancelling.

Parameters:
request - current HTTP request
command - form object with request parameters bound onto it
errors - validation errors holder
page - number of page to post-process
Throws:
java.lang.Exception - in case of invalid state or arguments

processFinish

protected abstract ModelAndView processFinish(javax.servlet.http.HttpServletRequest request,
                                              javax.servlet.http.HttpServletResponse response,
                                              java.lang.Object command,
                                              BindException errors)
                                       throws java.lang.Exception
Deprecated. 
Template method for processing the final action of this wizard.

Call errors.getModel() to populate the ModelAndView model with the command and the Errors instance, under the specified command name, as expected by the "spring:bind" tag.

You can call the showPage(javax.servlet.http.HttpServletRequest, org.springframework.validation.BindException, int) 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.

Parameters:
request - current HTTP request
response - current HTTP response
command - form object with the current wizard state
errors - validation errors holder
Returns:
the finish view
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
Errors, BindException.getModel(), showPage(javax.servlet.http.HttpServletRequest, org.springframework.validation.BindException, int)

processCancel

protected ModelAndView processCancel(javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.Object command,
                                     BindException errors)
                              throws java.lang.Exception
Deprecated. 
Template method for processing the cancel action of this wizard.

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 errors.getModel() to populate the ModelAndView model with the command and the Errors instance, under the specified command name, as expected by the "spring:bind" tag.

Parameters:
request - current HTTP request
response - current HTTP response
command - form object with the current wizard state
errors - Errors instance containing errors
Returns:
the cancellation view
Throws:
java.lang.Exception - in case of invalid state or arguments
See Also:
Errors, BindException.getModel()