Java Doc for AbstractFormController.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » servlet » mvc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.web.servlet.mvc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.web.servlet.mvc.AbstractController
   org.springframework.web.servlet.mvc.BaseCommandController
      org.springframework.web.servlet.mvc.AbstractFormController

All known Subclasses:   org.springframework.web.servlet.mvc.SimpleFormController,  org.springframework.web.servlet.mvc.AbstractWizardFormController,
AbstractFormController
abstract public class AbstractFormController extends BaseCommandController (Code)

Form controller that auto-populates a form bean from the request. This, either using a new bean instance per request, or using the same bean when the sessionForm property has been set to true.

This class is the base class for both framework subclasses like SimpleFormController SimpleFormController and AbstractWizardFormController AbstractWizardFormController , and custom form controllers you can provide yourself.

Both form-input views and after-submission views have to be provided programmatically. To provide those views using configuration properties, use the SimpleFormController SimpleFormController .

Subclasses need to override showForm to prepare the form view, and processFormSubmission to handle submit requests. For the latter, binding errors like type mismatches will be reported via the given "errors" holder. For additional custom form validation, a validator (property inherited from BaseCommandController) can be used, reporting via the same "errors" instance.

Comparing this Controller to the Struts notion of the Action shows us that with Spring, you can use any ordinary JavaBeans or database- backed JavaBeans without having to implement a framework-specific class (like Struts' ActionForm). More complex properties of JavaBeans (Dates, Locales, but also your own application-specific or compound types) can be represented and submitted to the controller, by using the notion of a java.beans.PropertyEditor. For more information on that subject, see the workflow of this controller and the explanation of the BaseCommandController BaseCommandController .

Workflow (and that defined by superclass):

  1. The controller receives a request for a new form (typically a GET).
  2. Call to AbstractFormController.formBackingObject formBackingObject() which by default, returns an instance of the commandClass that has been configured (see the properties the superclass exposes), but can also be overridden to e.g. retrieve an object from the database (that needs to be modified using the form).
  3. Call to AbstractFormController.initBinder initBinder() which allows you to register custom editors for certain fields (often properties of non-primitive or non-String types) of the command class. This will render appropriate Strings for those property values, e.g. locale-specific date strings.
  4. Only if bindOnNewForm is set to true, then org.springframework.web.bind.ServletRequestDataBinder ServletRequestDataBinder gets applied to populate the new form object with initial request parameters and the AbstractFormController.onBindOnNewForm(HttpServletRequest,Object,BindException) callback method is called. Note: any defined Validators are not applied at this point, to allow partial binding. However be aware that any Binder customizations applied via initBinder() (such as org.springframework.validation.DataBinder.setRequiredFields(String[]) will still apply. As such, if using bindOnNewForm=true and initBinder() customizations are used to validate fields instead of using Validators, in the case that only some fields will be populated for the new form, there will potentially be some bind errors for missing fields in the errors object. Any view (JSP, etc.) that displays binder errors needs to be intelligent and for this case take into account whether it is displaying the initial form view or subsequent post results, skipping error display for the former.
  5. Call to AbstractFormController.showForm(HttpServletRequest,HttpServletResponse,BindException) showForm() to return a View that should be rendered (typically the view that renders the form). This method has to be implemented in subclasses.
  6. The showForm() implementation will call AbstractFormController.referenceData referenceData() , which you can implement to provide any relevant reference data you might need when editing a form (e.g. a List of Locale objects you're going to let the user select one from).
  7. Model gets exposed and view gets rendered, to let the user fill in the form.
  8. The controller receives a form submission (typically a POST). To use a different way of detecting a form submission, override the AbstractFormController.isFormSubmission isFormSubmission method.
  9. If sessionForm is not set, AbstractFormController.formBackingObject formBackingObject() is called to retrieve a form object. Otherwise, the controller tries to find the command object which is already bound in the session. If it cannot find the object, it does a call to AbstractFormController.handleInvalidSubmit handleInvalidSubmit which - by default - tries to create a new form object and resubmit the form.
  10. The org.springframework.web.bind.ServletRequestDataBinder ServletRequestDataBinder gets applied to populate the form object with current request parameters.
  11. Call to AbstractFormController.onBind onBind(HttpServletRequest, Object, Errors) which allows you to do custom processing after binding but before validation (e.g. to manually bind request parameters to bean properties, to be seen by the Validator).
  12. If validateOnBinding is set, a registered Validator will be invoked. The Validator will check the form object properties, and register corresponding errors via the given org.springframework.validation.Errors Errors
  13. object.
  14. Call to AbstractFormController.onBindAndValidate onBindAndValidate() which allows you to do custom processing after binding and validation (e.g. to manually bind request parameters, and to validate them outside a Validator).
  15. Call AbstractFormController.processFormSubmission(HttpServletRequest,HttpServletResponse,Object,BindException) processFormSubmission() to process the submission, with or without binding errors. This method has to be implemented in subclasses.

In session form mode, a submission without an existing form object in the session is considered invalid, like in case of a resubmit/reload by the browser. The AbstractFormController.handleInvalidSubmit handleInvalidSubmit method is invoked then, by default trying to resubmit. It can be overridden in subclasses to show corresponding messages or to redirect to a new form, in order to avoid duplicate submissions. The form object in the session can be considered a transaction token in that case.

Note that views should never retrieve form beans from the session but always from the request, as prepared by the form controller. Remember that some view technologies like Velocity cannot even access a HTTP session.

Exposed configuration properties (and those defined by superclass):
name default description
bindOnNewForm false Indicates whether to bind servlet request parameters when creating a new form. Otherwise, the parameters will only be bound on form submission attempts.
sessionForm false Indicates whether the form object should be kept in the session when a user asks for a new form. This allows you e.g. to retrieve an object from the database, let the user edit it, and then persist it again. Otherwise, a new command object will be created for each request (even when showing the form again after validation errors).


author:
   Rod Johnson
author:
   Juergen Hoeller
author:
   Alef Arendsen
author:
   Rob Harrop
author:
   Colin Sampaleanu
See Also:   AbstractFormController.showForm(HttpServletRequest,HttpServletResponse,BindException)
See Also:   AbstractFormController.processFormSubmission
See Also:   SimpleFormController
See Also:   AbstractWizardFormController



Constructor Summary
public  AbstractFormController()
     Create a new AbstractFormController.

Method Summary
protected  ObjectcurrentFormObject(HttpServletRequest request, Object sessionFormObject)
     Return the current form object to use for binding and further processing, based on the passed-in form object as found in the HttpSession.
protected  ObjectformBackingObject(HttpServletRequest request)
     Retrieve a backing object for the current form from the given request.

The properties of the form object will correspond to the form field values in your form view.

final protected  ObjectgetCommand(HttpServletRequest request)
     Return the form object for the given request.

Calls AbstractFormController.formBackingObject if not in session form mode. Else, retrieves the form object from the session.

final protected  BindExceptiongetErrorsForNewForm(HttpServletRequest request)
     Create a BindException instance for a new form.
protected  StringgetFormSessionAttributeName(HttpServletRequest request)
     Return the name of the HttpSession attribute that holds the form object for this form controller.
protected  StringgetFormSessionAttributeName()
     Return the name of the HttpSession attribute that holds the form object for this form controller.

Default is an internal name, of no relevance to applications, as the form session attribute is not usually accessed directly.

protected  ModelAndViewhandleInvalidSubmit(HttpServletRequest request, HttpServletResponse response)
     Handle an invalid submit request, e.g.
protected  ModelAndViewhandleRequestInternal(HttpServletRequest request, HttpServletResponse response)
     Handles two cases: form submissions and showing a new form.
final public  booleanisBindOnNewForm()
     Return if request parameters should be bound in case of a new form.
protected  booleanisFormSubmission(HttpServletRequest request)
     Determine if the given request represents a form submission.

The default implementation treats a POST request as form submission. Note: If the form session attribute doesn't exist when using session form mode, the request is always treated as new form by handleRequestInternal.

Subclasses can override this to use a custom strategy, e.g.

final public  booleanisSessionForm()
     Return if session form mode is activated.
protected  voidonBindOnNewForm(HttpServletRequest request, Object command, BindException errors)
     Callback for custom post-processing in terms of binding for a new form.
protected  voidonBindOnNewForm(HttpServletRequest request, Object command)
     Callback for custom post-processing in terms of binding for a new form.
abstract protected  ModelAndViewprocessFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
     Process form submission request.
protected  MapreferenceData(HttpServletRequest request, Object command, Errors errors)
     Create a reference data map for the given request, consisting of bean name/bean instance pairs as expected by ModelAndView.
final public  voidsetBindOnNewForm(boolean bindOnNewForm)
     Set if request parameters should be bound to the form object in case of a non-submitting request, i.e.
final public  voidsetSessionForm(boolean sessionForm)
     Activate resp.
abstract protected  ModelAndViewshowForm(HttpServletRequest request, HttpServletResponse response, BindException errors)
     Prepare the form model and view, including reference and error data.
final protected  ModelAndViewshowForm(HttpServletRequest request, BindException errors, String viewName)
     Prepare model and view for the given form, including reference and errors.
final protected  ModelAndViewshowForm(HttpServletRequest request, BindException errors, String viewName, Map controlModel)
     Prepare model and view for the given form, including reference and errors, adding a controller-specific control model.

In session form mode: Re-puts the form object in the session when returning to the form, as it has been removed by getCommand.

Can be used in subclasses to redirect back to a specific form page.
Parameters:
  request - current HTTP request
Parameters:
  errors - validation errors holder
Parameters:
  viewName - name of the form view
Parameters:
  controlModel - model map containing controller-specific control data(e.g.

final protected  ModelAndViewshowNewForm(HttpServletRequest request, HttpServletResponse response)
     Show a new form.


Constructor Detail
AbstractFormController
public AbstractFormController()(Code)
Create a new AbstractFormController.

Subclasses should set the following properties, either in the constructor or via a BeanFactory: commandName, commandClass, bindOnNewForm, sessionForm. Note that "commandClass" doesn't need to be set when overriding AbstractFormController.formBackingObject , since the latter determines the class anyway.

"cacheSeconds" is by default set to 0 (-> no caching for all form controllers).
See Also:   AbstractFormController.setCommandName
See Also:   AbstractFormController.setCommandClass
See Also:   AbstractFormController.setBindOnNewForm
See Also:   AbstractFormController.setSessionForm
See Also:   AbstractFormController.formBackingObject





Method Detail
currentFormObject
protected Object currentFormObject(HttpServletRequest request, Object sessionFormObject) throws Exception(Code)
Return the current form object to use for binding and further processing, based on the passed-in form object as found in the HttpSession.

The default implementation simply returns the session form object as-is. Subclasses can override this to post-process the session form object, for example reattaching it to a persistence manager.
Parameters:
  sessionFormObject - the form object retrieved from the HttpSession the form object to use for binding and further processing
throws:
  Exception - in case of invalid state or arguments




formBackingObject
protected Object formBackingObject(HttpServletRequest request) throws Exception(Code)
Retrieve a backing object for the current form from the given request.

The properties of the form object will correspond to the form field values in your form view. This object will be exposed in the model under the specified command name, to be accessed under that name in the view: for example, with a "spring:bind" tag. The default command name is "command".

Note that you need to activate session form mode to reuse the form-backing object across the entire form workflow. Else, a new instance of the command class will be created for each submission attempt, just using this backing object as template for the initial form.

The default implementation calls AbstractFormController.createCommand() , creating a new empty instance of the specified command class. Subclasses can override this to provide a preinitialized backing object.
Parameters:
  request - current HTTP request the backing object
throws:
  Exception - in case of invalid state or arguments
See Also:   AbstractFormController.setCommandName
See Also:   AbstractFormController.setCommandClass
See Also:   AbstractFormController.createCommand




getCommand
final protected Object getCommand(HttpServletRequest request) throws Exception(Code)
Return the form object for the given request.

Calls AbstractFormController.formBackingObject if not in session form mode. Else, retrieves the form object from the session. Note that the form object gets removed from the session, but it will be re-added when showing the form for resubmission.
Parameters:
  request - current HTTP request object form to bind onto
throws:
  org.springframework.web.HttpSessionRequiredException - if a session was expected but no active session (or session form object) found
throws:
  Exception - in case of invalid state or arguments
See Also:   AbstractFormController.formBackingObject




getErrorsForNewForm
final protected BindException getErrorsForNewForm(HttpServletRequest request) throws Exception(Code)
Create a BindException instance for a new form. Called by AbstractFormController.showNewForm .

Can be used directly when intending to show a new form but with special errors registered on it (for example, on invalid submit). Usually, the resulting BindException will be passed to AbstractFormController.showForm(HttpServletRequest,HttpServletResponse,BindException) , after registering the errors on it.
Parameters:
  request - current HTTP request the BindException instance
throws:
  Exception - in case of an invalid new form object
See Also:   AbstractFormController.showNewForm
See Also:   AbstractFormController.showForm(HttpServletRequest,HttpServletResponse,BindException)
See Also:   AbstractFormController.handleInvalidSubmit




getFormSessionAttributeName
protected String getFormSessionAttributeName(HttpServletRequest request)(Code)
Return the name of the HttpSession attribute that holds the form object for this form controller.

The default implementation delegates to the AbstractFormController.getFormSessionAttributeName() variant without arguments.
Parameters:
  request - current HTTP request the name of the form session attribute, or null if not in session form mode
See Also:   AbstractFormController.getFormSessionAttributeName
See Also:   javax.servlet.http.HttpSession.getAttribute




getFormSessionAttributeName
protected String getFormSessionAttributeName()(Code)
Return the name of the HttpSession attribute that holds the form object for this 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. the name of the form session attribute
See Also:   javax.servlet.http.HttpSession.getAttribute




handleInvalidSubmit
protected ModelAndView handleInvalidSubmit(HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
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 simply tries to resubmit the form with a new form object. This should also work if the user hit the back button, changed some form data, and resubmitted the form.

Note: To avoid duplicate submissions, you need to override this method. Either show some "invalid submit" message, or call AbstractFormController.showNewForm for resetting the form (prepopulating it with the current values if "bindOnNewForm" is true). In this case, the form object in the session serves as transaction token.

 protected ModelAndView handleInvalidSubmit(HttpServletRequest request, HttpServletResponse response) throws Exception {
 return showNewForm(request, response);
 }
You can also show a new form but with special errors registered on it:
 protected ModelAndView handleInvalidSubmit(HttpServletRequest request, HttpServletResponse response) throws Exception {
 BindException errors = getErrorsForNewForm(request);
 errors.reject("duplicateFormSubmission", "Duplicate form submission");
 return showForm(request, response, errors);
 }

Parameters:
  request - current HTTP request
Parameters:
  response - current HTTP response a prepared view, or null if handled directly
throws:
  Exception - in case of errors
See Also:   AbstractFormController.showNewForm
See Also:   AbstractFormController.getErrorsForNewForm
See Also:   AbstractFormController.showForm(HttpServletRequest,HttpServletResponse,BindException)
See Also:   AbstractFormController.setBindOnNewForm



handleRequestInternal
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
Handles two cases: form submissions and showing a new form. Delegates the decision between the two to AbstractFormController.isFormSubmission , always treating requests without existing form session attribute as new form when using session form mode.
See Also:   AbstractFormController.isFormSubmission
See Also:   AbstractFormController.showNewForm
See Also:   AbstractFormController.processFormSubmission



isBindOnNewForm
final public boolean isBindOnNewForm()(Code)
Return if request parameters should be bound in case of a new form.



isFormSubmission
protected boolean isFormSubmission(HttpServletRequest request)(Code)
Determine if the given request represents a form submission.

The default implementation treats a POST request as form submission. Note: If the form session attribute doesn't exist when using session form mode, the request is always treated as new form by handleRequestInternal.

Subclasses can override this to use a custom strategy, e.g. a specific request parameter (assumably a hidden field or submit button name).
Parameters:
  request - current HTTP request if the request represents a form submission




isSessionForm
final public boolean isSessionForm()(Code)
Return if session form mode is activated.



onBindOnNewForm
protected void onBindOnNewForm(HttpServletRequest request, Object command, BindException errors) throws Exception(Code)
Callback for custom post-processing in terms of binding for a new form. Called when preparing a new form if bindOnNewForm is true.

The default implementation delegates to onBindOnNewForm(request, command).
Parameters:
  request - current HTTP request
Parameters:
  command - the command object to perform further binding on
Parameters:
  errors - validation errors holder, allowing for additionalcustom registration of binding errors
throws:
  Exception - in case of invalid state or arguments
See Also:   AbstractFormController.onBindOnNewForm(javax.servlet.http.HttpServletRequest,Object)
See Also:   AbstractFormController.setBindOnNewForm




onBindOnNewForm
protected void onBindOnNewForm(HttpServletRequest request, Object command) throws Exception(Code)
Callback for custom post-processing in terms of binding for a new form.

Called by the default implementation of the AbstractFormController.onBindOnNewForm(HttpServletRequest,Object,BindException) variant with all parameters, after standard binding when displaying the form view. Only called if bindOnNewForm is set to true.

The default implementation is empty.
Parameters:
  request - current HTTP request
Parameters:
  command - the command object to perform further binding on
throws:
  Exception - in case of invalid state or arguments
See Also:   AbstractFormController.onBindOnNewForm(HttpServletRequest,Object,BindException)
See Also:   AbstractFormController.setBindOnNewForm(boolean)




processFormSubmission
abstract protected ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception(Code)
Process form submission request. Called by AbstractFormController.handleRequestInternal in case of a form submission, with or without binding errors. Implementations need to proceed properly, typically showing a form view in case of binding errors or performing a submit action else.

Subclasses can implement this to provide custom submission handling like triggering a custom action. They can also provide custom validation and call AbstractFormController.showForm(HttpServletRequest,HttpServletResponse,BindException) or proceed with the submission accordingly.

For a success view, 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. For a form view, simply return the ModelAndView object provided by AbstractFormController.showForm(HttpServletRequest,HttpServletResponse,BindException) .
Parameters:
  request - current servlet request
Parameters:
  response - current servlet response
Parameters:
  command - form object with request parameters bound onto it
Parameters:
  errors - holder without errors (subclass can add errors if it wants to) the prepared model and view, or null
throws:
  Exception - in case of errors
See Also:   AbstractFormController.handleRequestInternal
See Also:   AbstractFormController.isFormSubmission
See Also:   AbstractFormController.showForm(HttpServletRequest,HttpServletResponse,BindException)
See Also:   org.springframework.validation.Errors
See Also:   org.springframework.validation.BindException.getModel




referenceData
protected Map referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception(Code)
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
Parameters:
  command - form object with request parameters bound onto it
Parameters:
  errors - validation errors holder a Map with reference data entries, or null if none
throws:
  Exception - in case of invalid state or arguments
See Also:   ModelAndView




setBindOnNewForm
final public void setBindOnNewForm(boolean bindOnNewForm)(Code)
Set if request parameters should be bound to the form object in case of a non-submitting request, i.e. a new form.



setSessionForm
final public void setSessionForm(boolean sessionForm)(Code)
Activate resp. deactivate session form mode. In session form mode, the form is stored in the session to keep the form object instance between requests, instead of creating a new one on each request.

This is necessary for either wizard-style controllers that populate a single form object from multiple pages, or forms that populate a persistent object that needs to be identical to allow for tracking changes.




showForm
abstract protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException errors) throws Exception(Code)
Prepare the form model and view, including reference and error data. Can show a configured form page, or generate a form view programmatically.

A typical implementation will call showForm(request, errors, "myView") to prepare the form view for a specific view name, returning the ModelAndView provided there.

For building a custom ModelAndView, 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 also need to include the model returned by AbstractFormController.referenceData .

Note: If you decide to have a "formView" property specifying the view name, consider using SimpleFormController.
Parameters:
  request - current HTTP request
Parameters:
  response - current HTTP response
Parameters:
  errors - validation errors holder the prepared form view, or null if handled directly
throws:
  Exception - in case of invalid state or arguments
See Also:   AbstractFormController.showForm(HttpServletRequest,BindException,String)
See Also:   org.springframework.validation.Errors
See Also:   org.springframework.validation.BindException.getModel
See Also:   AbstractFormController.referenceData(HttpServletRequest,Object,Errors)
See Also:   SimpleFormController.setFormView




showForm
final protected ModelAndView showForm(HttpServletRequest request, BindException errors, String viewName) throws Exception(Code)
Prepare model and view for the given form, including reference and errors.

In session form mode: Re-puts the form object in the session when returning to the form, as it has been removed by getCommand.

Can be used in subclasses to redirect back to a specific form page.
Parameters:
  request - current HTTP request
Parameters:
  errors - validation errors holder
Parameters:
  viewName - name of the form view the prepared form view
throws:
  Exception - in case of invalid state or arguments




showForm
final protected ModelAndView showForm(HttpServletRequest request, BindException errors, String viewName, Map controlModel) throws Exception(Code)
Prepare model and view for the given form, including reference and errors, adding a controller-specific control model.

In session form mode: Re-puts the form object in the session when returning to the form, as it has been removed by getCommand.

Can be used in subclasses to redirect back to a specific form page.
Parameters:
  request - current HTTP request
Parameters:
  errors - validation errors holder
Parameters:
  viewName - name of the form view
Parameters:
  controlModel - model map containing controller-specific control data(e.g. current page in wizard-style controllers or special error message) the prepared form view
throws:
  Exception - in case of invalid state or arguments




showNewForm
final protected ModelAndView showNewForm(HttpServletRequest request, HttpServletResponse response) throws Exception(Code)
Show a new form. Prepares a backing object for the current form and the given request, including checking its validity.
Parameters:
  request - current HTTP request
Parameters:
  response - current HTTP response the prepared form view
throws:
  Exception - in case of an invalid new form object
See Also:   AbstractFormController.getErrorsForNewForm



Fields inherited from org.springframework.web.servlet.mvc.BaseCommandController
final public static String DEFAULT_COMMAND_NAME(Code)(Java Doc)

Methods inherited from org.springframework.web.servlet.mvc.BaseCommandController
final protected ServletRequestDataBinder bindAndValidate(HttpServletRequest request, Object command) throws Exception(Code)(Java Doc)
final protected boolean checkCommand(Object command)(Code)(Java Doc)
protected ServletRequestDataBinder createBinder(HttpServletRequest request, Object command) throws Exception(Code)(Java Doc)
final protected Object createCommand() throws Exception(Code)(Java Doc)
final public BindingErrorProcessor getBindingErrorProcessor()(Code)(Java Doc)
protected Object getCommand(HttpServletRequest request) throws Exception(Code)(Java Doc)
final public Class getCommandClass()(Code)(Java Doc)
final public String getCommandName()(Code)(Java Doc)
final public MessageCodesResolver getMessageCodesResolver()(Code)(Java Doc)
final public PropertyEditorRegistrar[] getPropertyEditorRegistrars()(Code)(Java Doc)
final public Validator getValidator()(Code)(Java Doc)
final public Validator[] getValidators()(Code)(Java Doc)
protected void initApplicationContext()(Code)(Java Doc)
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception(Code)(Java Doc)
final public boolean isValidateOnBinding()(Code)(Java Doc)
protected void onBind(HttpServletRequest request, Object command, BindException errors) throws Exception(Code)(Java Doc)
protected void onBind(HttpServletRequest request, Object command) throws Exception(Code)(Java Doc)
protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors) throws Exception(Code)(Java Doc)
final protected void prepareBinder(ServletRequestDataBinder binder)(Code)(Java Doc)
final public void setBindingErrorProcessor(BindingErrorProcessor bindingErrorProcessor)(Code)(Java Doc)
final public void setCommandClass(Class commandClass)(Code)(Java Doc)
final public void setCommandName(String commandName)(Code)(Java Doc)
final public void setMessageCodesResolver(MessageCodesResolver messageCodesResolver)(Code)(Java Doc)
final public void setPropertyEditorRegistrar(PropertyEditorRegistrar propertyEditorRegistrar)(Code)(Java Doc)
final public void setPropertyEditorRegistrars(PropertyEditorRegistrar[] propertyEditorRegistrars)(Code)(Java Doc)
final public void setValidateOnBinding(boolean validateOnBinding)(Code)(Java Doc)
final public void setValidator(Validator validator)(Code)(Java Doc)
final public void setValidators(Validator[] validators)(Code)(Java Doc)
protected boolean suppressBinding(HttpServletRequest request)(Code)(Java Doc)
protected boolean suppressValidation(HttpServletRequest request, Object command, BindException errors)(Code)(Java Doc)
protected boolean suppressValidation(HttpServletRequest request, Object command)(Code)(Java Doc)
protected boolean suppressValidation(HttpServletRequest request)(Code)(Java Doc)
protected boolean useDirectFieldAccess()(Code)(Java Doc)

Methods inherited from org.springframework.web.servlet.mvc.AbstractController
final public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)
abstract protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc)
final public boolean isSynchronizeOnSession()(Code)(Java Doc)
final public void setSynchronizeOnSession(boolean synchronizeOnSession)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.