public class FieldFormController
extends org.springframework.web.servlet.mvc.SimpleFormController
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
log
Logger for this class and subclasses
|
DEFAULT_COMMAND_NAME
Constructor and Description |
---|
FieldFormController() |
Modifier and Type | Method and Description |
---|---|
protected Object |
formBackingObject(javax.servlet.http.HttpServletRequest request)
This is called prior to displaying a form for the first time.
|
protected void |
initBinder(javax.servlet.http.HttpServletRequest request,
org.springframework.web.bind.ServletRequestDataBinder binder)
Initialize the given binder instance, for example with custom editors.
|
protected org.springframework.web.servlet.ModelAndView |
onSubmit(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object obj,
org.springframework.validation.BindException errors)
The onSubmit function receives the form/command object that was modified by the input form
and saves it to the db
|
protected org.springframework.web.servlet.ModelAndView |
processFormSubmission(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse reponse,
Object obj,
org.springframework.validation.BindException errors)
This implementation calls
SimpleFormController.showForm(HttpServletRequest, HttpServletResponse, BindException)
in case of errors, and delegates to the full
SimpleFormController.onSubmit(HttpServletRequest, HttpServletResponse, Object, BindException) 's
variant else. |
protected Map<String,Object> |
referenceData(javax.servlet.http.HttpServletRequest request,
Object obj,
org.springframework.validation.Errors errors)
Create a reference data map for the given request and command,
consisting of bean name/bean instance pairs as expected by ModelAndView.
|
doSubmitAction, getFormView, getSuccessView, isFormChangeRequest, isFormChangeRequest, onFormChange, onFormChange, onSubmit, onSubmit, referenceData, setFormView, setSuccessView, showForm, showForm, suppressValidation
currentFormObject, getCommand, getErrorsForNewForm, getFormSessionAttributeName, getFormSessionAttributeName, handleInvalidSubmit, handleRequestInternal, isBindOnNewForm, isFormSubmission, isSessionForm, onBindOnNewForm, onBindOnNewForm, setBindOnNewForm, setSessionForm, showForm, showForm, showNewForm
bindAndValidate, checkCommand, createBinder, createCommand, getBindingErrorProcessor, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getValidator, getValidators, getWebBindingInitializer, initApplicationContext, isValidateOnBinding, onBind, onBind, onBindAndValidate, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, setWebBindingInitializer, suppressBinding, suppressValidation, suppressValidation, useDirectFieldAccess
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setAlwaysMustRevalidate, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
protected final org.apache.commons.logging.Log log
protected void initBinder(javax.servlet.http.HttpServletRequest request, org.springframework.web.bind.ServletRequestDataBinder binder) throws Exception
org.springframework.web.servlet.mvc.BaseCommandController
BaseCommandController.createBinder(javax.servlet.http.HttpServletRequest, java.lang.Object)
.
This method allows you to register custom editors for certain fields of your command class. For instance, you will be able to transform Date objects into a String pattern and back, in order to allow your JavaBeans to have Date properties and still be able to set and display them in an HTML interface.
The default implementation is empty.
initBinder
in class org.springframework.web.servlet.mvc.BaseCommandController
request
- current HTTP requestbinder
- the new binder instanceException
- in case of invalid state or argumentsBaseCommandController.createBinder(javax.servlet.http.HttpServletRequest, java.lang.Object)
,
DataBinder.registerCustomEditor(java.lang.Class<?>, java.beans.PropertyEditor)
,
CustomDateEditor
protected org.springframework.web.servlet.ModelAndView processFormSubmission(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse reponse, Object obj, org.springframework.validation.BindException errors) throws Exception
org.springframework.web.servlet.mvc.SimpleFormController
SimpleFormController.showForm(HttpServletRequest, HttpServletResponse, BindException)
in case of errors, and delegates to the full
SimpleFormController.onSubmit(HttpServletRequest, HttpServletResponse, Object, BindException)
's
variant else.
This can only be overridden to check for an action that should be executed
without respect to binding errors, like a cancel action. To just handle successful
submissions without binding errors, override one of the onSubmit
methods or SimpleFormController.doSubmitAction(java.lang.Object)
.
processFormSubmission
in class org.springframework.web.servlet.mvc.SimpleFormController
request
- current servlet requestreponse
- current servlet responseobj
- form object with request parameters bound onto iterrors
- holder without errors (subclass can add errors if it wants to)null
Exception
- in case of errorsSimpleFormController.showForm(HttpServletRequest, HttpServletResponse, BindException)
,
SimpleFormController.onSubmit(HttpServletRequest, HttpServletResponse, Object, BindException)
,
SimpleFormController.onSubmit(Object, BindException)
,
SimpleFormController.onSubmit(Object)
,
SimpleFormController.doSubmitAction(Object)
protected org.springframework.web.servlet.ModelAndView onSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object obj, org.springframework.validation.BindException errors) throws Exception
onSubmit
in class org.springframework.web.servlet.mvc.SimpleFormController
request
- current servlet requestresponse
- current servlet responseobj
- form object with request parameters bound onto iterrors
- Errors instance without errors (subclass can add errors if it wants to)null
Exception
- in case of errorsSimpleFormController.onSubmit(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, java.lang.Object,
org.springframework.validation.BindException)
protected Object formBackingObject(javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
formBackingObject
in class org.springframework.web.servlet.mvc.AbstractFormController
request
- current HTTP requestjavax.servlet.ServletException
AbstractFormController.formBackingObject(javax.servlet.http.HttpServletRequest)
protected Map<String,Object> referenceData(javax.servlet.http.HttpServletRequest request, Object obj, org.springframework.validation.Errors errors) throws Exception
org.springframework.web.servlet.mvc.SimpleFormController
The default implementation delegates to SimpleFormController.referenceData(HttpServletRequest)
.
Subclasses can override this to set reference data used in the view.
referenceData
in class org.springframework.web.servlet.mvc.SimpleFormController
request
- current HTTP requestobj
- form object with request parameters bound onto iterrors
- validation errors holdernull
if noneException
- in case of invalid state or argumentsModelAndView
Copyright © 2015 OpenMRS Inc.. All rights reserved.