Several MVC Web frameworks such as Struts, Wickets, and Tapestry can be used for creating Web applications.
The Spring framework also has its own MVC implementation, the Spring MVC Web framework.
This framework has the following features that make it better than the other MVC frameworks
Is a highly robust, flexible, and well-designed framework that is used for rapidly developing Web applications using the MVC design pattern.
Takes advantage of the AOP and DI features of the Spring framework to enable you to create loosely coupled Web applications.
Is built around a front controller servlet called dispatcher servlet.
Handler mappings :Enables the dispatcher servlet to forward the incoming requests to the appropriate controllers.
Controllers :Provide the application logic to process the incoming user request and generate the appropriate response.
View resolvers :Are used for resolving the logical view names returned by the controller to the actual views.
View :Is used to display the desired response to the user on the browser screen.
When a user requests for a particular page, the request is received by a front controller at the server.
The front controller is a servlet called dispatcher servlet and is represented by the org.springframework.web.servlet.DispatcherServlet class.
The Dispatcher Servlet class is integrated with the Spring framework's ApplicationContext interface.
This integration allows you to use major features, such as DI and AOP,of the Spring framework.
The dispatcher servlet intercepts all user requests before passing them to a controller class.
For a dispatcher servlet to intercept all user requests, declare and configure it in the web.xml configuration file with the help of the following elements:
<servlet> <servlet-name>dispatcher</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping>