Overview:
1.Spring is an excellent web framework based on MVC design concept provided by the presentation layer, which is one of the most mainstream MVC frameworks today.
2.Spring MVC uses a set of MVC annotations to make POJO the controller that handles requests without having to implement any interfaces.
3. Support for RESTful URL requests.
4. The loosely coupled pluggable component structure is more scalable and flexible than other MVC frameworks.
Spring MVC consists mainly of Dispatcherservlet, processor mappings, processors (controllers), view parsers, and views. His two cores are two cores:
Processor mapping: Choose which controller to use to process the request.
View parser: Select how the results should be rendered.
SPRINGMVC Working principle:
1. HTTP Request: Client request submitted to Dispatcherservlet.
2. Find the Processor: the Dispatcherservlet controller queries one or more handlermapping to find the controller that handles the request.
3. Call Processor: Dispatcherservlet submits the request to the controller.
4. Call the business process and return the result: After the controller invokes the business logic processing, it returns Modelandview.
5. Process the view map and return the model: Dispatcherservlet queries one or more Viewresoler view resolvers to find the Modelandview specified view.
6. HTTP response: The view is responsible for displaying the results to the client.
Springmvc Interface Explanation:
(1) Dispatcherservlet interface:
Spring provides a front-end controller that all requests have to be distributed uniformly. Before Dispatcherservlet will distribute the request to the spring controller, it needs to navigate to the specific controller using the handlermapping provided by spring.
(2) Handlermapping interface:
Requests the customer to the controller map.
(3) Controller interface:
The above requests need to be handled for concurrent users, so when implementing the Controller interface, you must ensure that threads are secure and reusable.
The controller will process the user request, which is consistent with the role that struts action plays. Once the controller has finished processing the user request, the Modelandview object is returned to the Dispatcherservlet front-end controller, and the model and view are included in Modelandview.
From the macroscopic point of view, Dispatcherservlet is the controller of the whole Web application, and from the microscopic consideration, the controller is a control in the process of single HTTP request processing. Modelandview is the model and view that is returned during the HTTP request.
(4) Viewresolver interface:
Spring provides a view parser (Viewresolver) to look up a View object in a Web app, rendering the result to the customer.
Overview of SPRINGMVC-SPRINGMVC