This blog explains about the Spring MVC architecture. Below two diagrams give an overview of Spring
architecture.
- In coming requests are handled by Front Controller. Spring MVC uses a java servlet known as DisptcherServlet. This servlet is responsible for receiving requests, delegate real work to POJO's called controllers. In order to delegate the task to appropriate controller, DispatherServlet takes the help of Handler mapping.
- Handler mapping takes the request and based on the request URL the request is dispatched to the appropriate controller.
- Once the controller receives the request, it processes the data and performs any business logic related to the application.
- Once the controller is done with the business logic, it generates output. This output is sent to the view, but this output should be formatted in a way that user can understand.
- The controller for formatting the view, takes the help of ModelAndView. ModelAndView is a component which takes both Model and View from the controller and encapsulates it in a ModelAndView object and gives it to the DispatcherServet.
- The DipatcherServlet takes the ModelAndView object and passes it to ViewResolver. Depending on the object, ViewResolver will return the appropriate view.
No comments:
Post a Comment