Controllers in Spring MVC by R4R Team

Controllers in Spring MVC:-

Spring provides many types of controllers.This can be both good and bad.The good thing is that you have a variety of controllers to choose from, but that also happens to be the bad part because it can be a bit confusing at first about which one to use. The best way to decide which controller type to use probably is by knowing what type of functionality you need.

 The DispatcherServlet delegates the request to the controllers to execute the functionality specific part of it. There are many abstract controllers available in this framework which support specific tasks. Each abstract controller provides a method to be overridden by the controllers.


1 AbstractController: Responsible for providing services applicable to any kind of HTTP request. Configurable attributes available are supportedMethods – GET/POST, requireSession, synchronizeOnSession, cacheSession, useExpiresHeader, useCacheHeader. Override handleRequestInternal(HttpServletRequest, HttpServletResponse) method.

2 ParameterizableViewController: Specifies view name to return WebApplicationContext.

3 UrlFilenameViewController: Inspects URL, retrieves file name of the file request and uses that as a view name.

4 MultiActionController: Handles multiple requests and needs MethodNameResolver or ParameterMethodNameResolver to work with. One method represents one action in this controller.

5 AbstractCommandController: Populates command object with request parameters available in controller. Offers validation features but does not offer form functionality.

6 AbstractFormController: Models forms using command objects, validates command object, and makes those available in controller. Just that id does not support the view determination.

7 SimpleFormController: It does everything that the AbstractFormController does and in addition to that it supports the view identification and redirection.

8 AbstractWizardController: It is to be used for Wizard kind of screen group, features required in a wizard functionality (validate, process start, process finish, etc.) are supported by this controller.

Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!