Spring Mvc is a sub-framework of spring framework which is used to build applications.
it is built on top of the servelet API.
it follows the model-view-controller design pattern.
it is implemented all the basic features of a core spring framework like an inversion of control, and dependency injection.
rapid application development.
spring MVC is Flexible.
3
Model - A model contains the data of the application. Data can be a single object or a collection of objects.
Controller - A controller contains the business logic of an application. Here, the @Controller annotation is used to mark the class as the controller.
View - A view represents the provided information in a particular format. So, we can create a view page by using view technologies like JSP+JSTL, Apache Velocity, Thymeleaf, and FreeMarker.
What is the flow of Spring MVC?
Once the request has been generated, it is intercepted by the DispatcherServlet that works as the front controller.
The DispatcherServlet gets an entry of handler mapping from the XML file and forwards the request to the controller.
The controller returns an object of ModelAndView.
The DispatcherServlet checks the entry of the view resolver in the XML file and invokes the specified view component.
spring MVC creation step
1. Configure the dispatcher servlet in web.xml
2. Create Spring Configuration File
3. Configure View Resolver
4. Create Controller
5. Create a View to show(page)
Comments