Mvcspring's MVC framework consists mainly of Dispatcherservlet, processor mappings, processors, view parsers, and views. Schematic diagram of Spring MVC: The entire process begins with an HTTP request:
1) Dispatcherservlet after receiving the request, according to the processor mapping configured in the corresponding configuration file, find the corresponding processor mapping entry (handlermapping), according to the configured mapping rules, find the corresponding processor (Handler).
2) Call the processing method in the appropriate processor and process the request, and the processor will pass a Modelandview type of data to Dispatcherservlet, which contains the data to be used in the view and view of the processing result.
3) Dispatcherservlet Find a suitable viewresolver (view parser) according to the View object in the resulting modelandview, according to the configuration of the view parser, Dispatcherservlet the view to display the data to the corresponding view, and finally constructs an HTTP response to the browser.
Dispatcherservlet is the core of the whole 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) initializes the Webapplicationcontext that corresponds to the Dispatcherservlet context and associates it with the business layer, webapplicationcontext of the persistence layer.
3) Initialize the various components of spring MVC and assemble them into the dispatcherservlet.
Spring MVC principle