Quick learning of springMVC framework principles and quick learning of springmvc
1. quickly understand the principles of springmvc through graph Export
Ii. Architecture process.
1. the user sends a request to the front-end controller DispatcherServlet
2. The DispatcherServlet receives a request to call the HandlerMapping processor er.
3. The processor er finds the specific processor based on the request url, generates the processor object and the processor Interceptor (if any), and returns it to DispatcherServlet.
4. DispatcherServlet calls the processor through the HandlerAdapter processor Adapter
5. The execution processor (Controller, also called the backend Controller ).
6. After the Controller is executed, return ModelAndView.
7. HandlerAdapter returns the controller execution result ModelAndView to DispatcherServlet
8. DispatcherServlet transmits ModelAndView to the ViewReslover view parser.
9. After ViewReslover resolution, return the specific View
10. DispatcherServlet renders the View (filling model data into the View ).
11. Respond to users with DispatcherServlet
Iii. Component Description
The following components are generally implemented using the framework:
1. DispatcherServlet: front-end Controller
When a user request arrives at the front-end controller, it is equivalent to c in mvc mode. dispatcherServlet is the center of the whole process control. It calls other components to process user requests, dispatcherServlet reduces the coupling between components.
2. HandlerMapping: processor er
HandlerMapping is responsible for finding Handler as the processor according to user requests. springmvc provides different ing modes for different mappers, such as configuration file mode, interface mode, and annotation mode.
3. Handler: processor (which needs to be developed by programmers and focuses on Learning)
Handler is the backend controller of the DispatcherServlet front-end controller. Under the Control of DispatcherServlet, Handler processes specific user requests.
Since Handler involves specific user business requests, programmers generally need to develop Handler based on business needs.
4. HandlAdapter: processor Adapter
Execute the processor through the HandlerAdapter, which is an application in the adapter mode. You can execute more types of processors through the extended adapter.
5. View Resolver: View parser
View Resolver is responsible for generating the View of the processing result. View Resolver first parses the logic View name into the physical View name, that is, the specific page address, and then generates the View object, finally, the View is rendered and the processing result is displayed on the page to the user. The springmvc framework provides many View types, including jstlView, freemarkerView, and lateral View.
Generally, the model data needs to be presented to users through the page tag or Page Template technology, and the programmer needs to develop a specific page according to the business needs.