(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) (5) Call the business processing and return the result : After the controller invokes the business logic processing, it returns Modelandview.
(6) (7) Process the view map and return the model : Dispatcherservlet queries One or more Viewresoler view resolvers to find the Modelandview specified view.
(8) HTTP response : The view is responsible for displaying the results to the client.
(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.
Is the core of the entire spring MVC. It is responsible for receiving the HTTP request organization to coordinate the various components of spring MVC. Its main work has the following three items:
(1) Intercept URL requests that match a specific format.
(2) Initialize the Dispatcherservlet context to correspond to Webapplicationcontext and associate it with the business layer, webapplicationcontext of the persistence layer.
(3) Initialize the various components of spring MVC and assemble them into the dispatcherservlet.
(2) handlermapping interface :
Ability to complete customer requests to controller mappings.
(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.
Configuration:
1.Web. XML set the path to Springmvc-context.xml
2.Springmvc-context.xml Open Annotation function, configure view resolver
SPRINGMVC basic work flow, basic configuration