com.interface21.web.servlet.mvc
Class AbstractCommandController
java.lang.Object
|
+--com.interface21.context.support.ApplicationObjectSupport
|
+--com.interface21.web.servlet.mvc.WebContentGenerator
|
+--com.interface21.web.servlet.mvc.AbstractController
|
+--com.interface21.web.servlet.mvc.BaseCommandController
|
+--com.interface21.web.servlet.mvc.AbstractCommandController
- All Implemented Interfaces:
- ApplicationContextAware, Controller
- public abstract class AbstractCommandController
- extends BaseCommandController
Abstract base class for custom command controllers. Autopopulates a
command bean from the request. For command validation, a validator
(property inherited from BaseCommandController) can be used.
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
BaseCommandController.setCommandClass(java.lang.Class),
BaseCommandController.setBeanName(java.lang.String),
BaseCommandController.setValidator(com.interface21.validation.Validator)
|
Method Summary |
protected abstract ModelAndView |
handle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object command,
BindException errors)
Template method for request handling, providing a populated and validated instance
of the command class, and an Errors object containing binding and validation errors.
|
protected ModelAndView |
handleRequestInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Template method. |
| Methods inherited from class com.interface21.web.servlet.mvc.BaseCommandController |
bindAndValidate, checkCommand, createBinder, createCommand, getBeanName, getCommandClass, getValidator, initBinder, isValidateOnBinding, onBindAndValidate, setBeanName, setCommandClass, setValidateOnBinding, setValidator, userObject |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractCommandController
public AbstractCommandController()
- Create a new AbstractCommandController.
AbstractCommandController
public AbstractCommandController(java.lang.Class commandClass)
- Create a new AbstractCommandController.
- Parameters:
commandClass - class of the command bean
AbstractCommandController
public AbstractCommandController(java.lang.Class commandClass,
java.lang.String beanName)
- Create a new AbstractCommandController.
- Parameters:
commandClass - class of the command beanbeanName - name of the command bean
handleRequestInternal
protected final ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Description copied from class:
AbstractController
- Template method. Subclasses must implement this.
The contract is the same as for handleRequest.
- Overrides:
handleRequestInternal in class AbstractController
- Following copied from class:
com.interface21.web.servlet.mvc.AbstractController
- See Also:
AbstractController.handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
handle
protected abstract ModelAndView handle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object command,
BindException errors)
throws javax.servlet.ServletException,
java.io.IOException
- Template method for request handling, providing a populated and validated instance
of the command class, and an Errors object containing binding and validation errors.
Can call errors.getModel() to populate the ModelAndView model with the command
and the errors instance, under the specified bean name.
- Parameters:
request - current HTTP requestresponse - current HTTP responsecommand - the populated command objecterrors - the binder containing errors- Returns:
- a ModelAndView to render, or null if handled directly
Rod Johnson and Spring contributors 2001-2003.