| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Base Controller interface, representing a component that receives HttpServletRequest
 and HttpServletResponse like a HttpServlet but is able to participate in
 an MVC workflow. Comparable to the notion of a Struts Action
 
Any implementation of the Controller interface should be a reusable, threadsafe class, capable of handling multiple HTTP requests throughout the lifecycle of an application. To be able to configure Controller in an easy, Controllers are usually JavaBeans.
Workflow:
 After the DispatcherServlet has received a request and has done its work
 to resolve locales, themes and things a like, it tries to resolve
 a Controller, using a HandlerMapping. When a Controller has been found, the \
 handleRequest()
 method will be invoked, which is responsible for handling the actual
 request and - if applicable - returning an appropriate ModelAndView.
 So actually, this method is the main entrypoint for the
 DispatcherServlet
 which delegates requests to controllers. This method - and also this interface -
 should preferrably not be implemented by custom controllers directly, since
 abstract controller also provided by this package already provide a lot
 of functionality common for virtually all webapplications. A few examples of
 those abstract controllers:
 AbstractController,
 AbstractCommandController and
 AbstractFormController.
 
So basically any direct implementation of the Controller interface just handles HttpServletRequests and should return a ModelAndView, to be further used by the DispatcherServlet. Any additional functionality such as optional validation, formhandling, etcetera should be obtained by extended one of the abstract controller mentioned above.
SimpleControllerHandlerAdapter| Method Summary | |
|  ModelAndView | handleRequest(javax.servlet.http.HttpServletRequest request,
              javax.servlet.http.HttpServletResponse response)Process the request and return a ModelAndView object which the DispatcherServlet will render. | 
| Method Detail | 
public ModelAndView handleRequest(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
                           throws java.lang.Exception
request - current HTTP requestresponse - current HTTP response
java.lang.Exception - in case of errors| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||