1.1 springmvc framework
Step 1: Initiate a request to the front controller (DispatcherServlet)
Step 2: The front controller requests HandlerMapping to find the Handler
You can search according to xml configuration and annotations
Step 3: The handler mapper HandlerMapping returns Handler to the front controller
Step 4: The front controller calls the handler adapter to execute the Handler
Step 5: Handler adapter to execute Handler
Step 6: Handler execution completes and returns ModelAndView to the adapter
Step 7: The handler adapter returns the ModelAndView to the front controller
ModelAndView is an underlying object of the springmvc framework, including Model and view
Step 8: The front controller requests the view resolver to perform view resolution
According to the logical view name is resolved into a real view (jsp)
Step 9: The view resolver returns the View to the front controller
Step 10: Front-end controller for view rendering
View rendering populates the request field with model data ( in the ModelAndView object )
Step 11: The front controller responds to the user with the result
Components:
1. Front-end controller DispatcherServlet (no need for programmer development)
The function is to receive the request and respond to the result, which is equivalent to the repeater, the central processing unit.
With DispatcherServlet reduces the coupling between other components.
2 , the processor mapper HandlerMapping ( no need for programmer development )
Role: Find Handler according to the requested url
3. Handler Adapter HandlerAdapter
Role: execute Handler according to specific rules (rules required by HandlerAdapter )
4. Handler ( requires programmer development )
Note: When writing Handler , follow the requirements of HandlerAdapter , so that the adapter can execute Handler correctly
5. View resolver View resolver ( no need for programmer development )
Function: perform view resolution, and resolve it into a real view ( view ) according to the logical view name
6. View View ( requires programmers to develop jsp )
View is an interface, and the implementation class supports different View types ( jsp , freemarker , pdf... )
From the dark horse programmer, it is only used for learning and communication. If there is any infringement, please contact me.