public abstract class BaseFormController
extends org.springframework.web.servlet.mvc.SimpleFormController
DEFAULT_COMMAND_NAME
Constructor and Description |
---|
BaseFormController() |
Modifier and Type | Method and Description |
---|---|
protected Locale |
getLocale(javax.servlet.http.HttpServletRequest request) |
protected abstract org.springframework.web.servlet.ModelAndView |
handleOnSubmit(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object command,
org.springframework.validation.BindException errors)
Is called by
onSubmit(HttpServletRequest, HttpServletResponse, Object, BindException)
Submit callback with all parameters. |
protected void |
initBinder(javax.servlet.http.HttpServletRequest request,
org.springframework.web.bind.ServletRequestDataBinder binder)
Override to disable autogrowth.
|
boolean |
isRefuseOnExternalAuthentication()
Returns true if the access to this form is not allowed on activated external authentiaction
e.g.
|
protected org.springframework.web.servlet.ModelAndView |
onSubmit(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object command,
org.springframework.validation.BindException errors) |
protected org.springframework.web.servlet.ModelAndView |
onSubmit(Object command)
Is final to avoid inheriting subclasse. |
protected org.springframework.web.servlet.ModelAndView |
onSubmit(Object command,
org.springframework.validation.BindException errors)
Is final to avoid inheriting subclasse. |
void |
setRefuseOnExternalAuthentication(boolean redirectOnExternalAuthentication)
If the form is refused on activated external authentication, the user will be redirected to
the portal home page.
|
protected org.springframework.web.servlet.ModelAndView |
showForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.validation.BindException errors) |
doSubmitAction, getFormView, getSuccessView, isFormChangeRequest, isFormChangeRequest, onFormChange, onFormChange, processFormSubmission, referenceData, referenceData, setFormView, setSuccessView, showForm, suppressValidation
currentFormObject, formBackingObject, 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 Locale getLocale(javax.servlet.http.HttpServletRequest request)
request
- the requestprotected abstract org.springframework.web.servlet.ModelAndView handleOnSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object command, org.springframework.validation.BindException errors) throws Exception
onSubmit(HttpServletRequest, HttpServletResponse, Object, BindException)
The default implementation delegates to onSubmit(Object, BindException)
. For simply
performing a submit action and rendering the specified success view, consider implementing
SimpleFormController.doSubmitAction(java.lang.Object)
rather than an onSubmit
variant.
Subclasses can override this to provide custom submission handling like storing the object to the database. Implementations can also perform custom validation and call showForm to return to the form. Do not implement multiple onSubmit methods: In that case, just this method will be called by the controller.
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.
request
- current servlet requestresponse
- current servlet responsecommand
- 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 errorsonSubmit(Object, BindException)
,
SimpleFormController.doSubmitAction(java.lang.Object)
,
showForm(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.springframework.validation.BindException)
,
Errors
,
BindException.getModel()
protected void initBinder(javax.servlet.http.HttpServletRequest request, org.springframework.web.bind.ServletRequestDataBinder binder) throws Exception
initBinder
in class org.springframework.web.servlet.mvc.BaseCommandController
Exception
public boolean isRefuseOnExternalAuthentication()
protected org.springframework.web.servlet.ModelAndView onSubmit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object command, org.springframework.validation.BindException errors) throws Exception
onSubmit
in class org.springframework.web.servlet.mvc.SimpleFormController
Exception
protected final org.springframework.web.servlet.ModelAndView onSubmit(Object command) throws Exception
handleOnSubmit(HttpServletRequest, HttpServletResponse, Object, BindException)
instead.onSubmit
in class org.springframework.web.servlet.mvc.SimpleFormController
Exception
protected final org.springframework.web.servlet.ModelAndView onSubmit(Object command, org.springframework.validation.BindException errors) throws Exception
handleOnSubmit(HttpServletRequest, HttpServletResponse, Object, BindException)
instead.onSubmit
in class org.springframework.web.servlet.mvc.SimpleFormController
Exception
public void setRefuseOnExternalAuthentication(boolean redirectOnExternalAuthentication)
redirectOnExternalAuthentication
- the redirectOnExternalAuthentication to setprotected org.springframework.web.servlet.ModelAndView showForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.validation.BindException errors) throws Exception
showForm
in class org.springframework.web.servlet.mvc.SimpleFormController
Exception
SimpleFormController.showForm(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, org.springframework.validation.BindException)
Copyright © 2019 Communote team. All rights reserved.