Spring Framework

Spring Projects

Spring Project 1

adplus-dvertising
AbstractFormController in String MVC
Previous Home Next

This controller provide the facility to auto-populates a form bean from the request. this form controller using new bean instance per request and its also provide the same bean when the sessionForm property has been sent to true.

This controller class is the base class of SimpleFormController and AbstractWizardFromController. both form-input views and after-submission view provided this controller class through the programmatically which are configure in spring applicationContext file. Its subclass also override the showForm() method for view and processFormSubmission to handle submit request .

Syntax:

public abstract class AbstractFormController
extends BaseCommandController

This controller class also provide following type of method:

setBindOnNewForm:

public final void setBindOnForm(boolean bindOnNewForm)

isBindOnNewForm:

public final boolean isBindOnNewForm()

setSessionForm:

public final void setSessionForm(boolean sessionForm)

isSessionForm:

public final boolean isSessionForm()

handleRequestInternal:

protected ModelAndView handleRequestInternal(httpServletRequest
request,HttpServletResponse response)throws Exception

isFormSubmission:

protected boolean isFormSubmission(HttpServletRequest request)

getFormSessionAttributeName:

protected String getFormSessionAttributeName(HttpServletRequest
requesat)

showNewForm:

protected final ModelAndView showNewForm(HttpServletRequest
request,HttpServletResponse)throws Exception

getErrorsForNewForm:

protected final BindException getErrorsForNewForm
(HttpServletRequest request)throws Exception

onBindOnNewForm:

protected void onBindOnNewForm(HttpServletRequest request,
Object command, BindException errors)throws Exception

onBindOnNewForm:

protected void onBindOnNewForm(HttpServletRequest request,
Object command)throws Exception

getCommand:

protected final Object getCommand(httpServletRequest
request)throws Exception

formBackingObject:

protected Object formBackingObject(HttpServletRequest
request)throws Exception

currentFormObject:

protected Object currentFormObject(HttpServletRequest
request,Object sessionFormObject)throws Exception

showForm:

protected abstract ModelAndView showForm
(httpServletRequest request,HttpServletResponse response
,BindException errors)throws Exception

showForm:

protected final ModelAndView showForm
(httpServletRequest request,BindException errors,
String view Name)throws Exception

showForm:

protected abstract ModelAndView showForm
(httpServletRequest request,BindException errors,
String viewName,Map controlModel)throws Exception

referenceData:

protected Map referenceData(HttpServletRequest
request,Object command,Errors errors)Throws Exception

processFormSubmission:

protectes abstract ModelAndView processFormSubmission
(HttpServletRequest request,HttpServletResponse response
,Object command,BindException errors)throws Exception

handleInvalidSubmit:

protected ModelAndView handleInvalidSubmit
(HttpServletRequest request,HttpServletResponse response)
throws Exception

Example of AbstractController in Spring MVC

Previous Home Next