public abstract class

AbstractCommandController

extends BaseCommandController
java.lang.Object
   ↳ org.springframework.context.support.ApplicationObjectSupport
     ↳ org.springframework.web.context.support.WebApplicationObjectSupport
       ↳ org.springframework.web.servlet.support.WebContentGenerator
         ↳ org.springframework.web.servlet.mvc.AbstractController
           ↳ org.springframework.web.servlet.mvc.BaseCommandController
             ↳ org.springframework.web.servlet.mvc.AbstractCommandController

This class is deprecated.
as of Spring 3.0, in favor of annotated controllers

Class Overview

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.

In most cases this command controller should not be used to handle form submission, because functionality for forms is offered in more detail by the AbstractFormController and its corresponding implementations.

Exposed configuration properties (and those defined by superclass):
none (so only those available in superclass).

Workflow (and that defined by superclass):

Summary

[Expand]
Inherited Constants
From class org.springframework.web.servlet.mvc.BaseCommandController
From class org.springframework.web.servlet.support.WebContentGenerator
[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
Public Constructors
AbstractCommandController()
Create a new AbstractCommandController.
AbstractCommandController(Class commandClass)
Create a new AbstractCommandController.
AbstractCommandController(Class commandClass, String commandName)
Create a new AbstractCommandController.
Protected Methods
abstract ModelAndView handle(HttpServletRequest request, HttpServletResponse response, 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.
ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
Template method.
[Expand]
Inherited Methods
From class org.springframework.web.servlet.mvc.BaseCommandController
From class org.springframework.web.servlet.mvc.AbstractController
From class org.springframework.web.servlet.support.WebContentGenerator
From class org.springframework.web.context.support.WebApplicationObjectSupport
From class org.springframework.context.support.ApplicationObjectSupport
From class java.lang.Object
From interface org.springframework.context.ApplicationContextAware
From interface org.springframework.web.context.ServletContextAware
From interface org.springframework.web.servlet.mvc.Controller

Public Constructors

public AbstractCommandController ()

Create a new AbstractCommandController.

public AbstractCommandController (Class commandClass)

Create a new AbstractCommandController.

Parameters
commandClass class of the command bean

public AbstractCommandController (Class commandClass, String commandName)

Create a new AbstractCommandController.

Parameters
commandClass class of the command bean
commandName name of the command bean

Protected Methods

protected abstract ModelAndView handle (HttpServletRequest request, HttpServletResponse response, 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.

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.

Parameters
request current HTTP request
response current HTTP response
command the populated command object
errors validation errors holder
Returns
  • a ModelAndView to render, or null if handled directly
Throws
Exception
See Also

protected ModelAndView handleRequestInternal (HttpServletRequest request, HttpServletResponse response)

Template method. Subclasses must implement this. The contract is the same as for handleRequest.

Throws
Exception