Joke Collection Website - Blessing messages - The detailed process of spring mvc

The detailed process of spring mvc

The running process of Spring MVC

① In the whole Spring MVC framework, the DispatcherServlet is in the core position, responsible for coordinating and organizing different components to complete the request processing and return the response.

(2) ②.SpringMVC processing request flow:

& gt if the request matches the request mapping path of the DispatcherServlet (specified in web.xml),

The WEB container forwards the request to the DispatcherServlet for processing.

& gtDispatcherServlet will respond to the request information (including URL, HTTP method, request header, request parameters, Cookie, etc.) after receiving the request. ) and

HandlerMapping's configuration found a handler to handle the request. HandlerMapping can be regarded as a route controller, and Handler can be regarded as a target host.

& gt when the DispatcherServlet obtains the handler corresponding to the current request according to the HandlerMapping, it will pass the HandlerAdapter.

Encapsulate the handler, and then call the handler with a unified adapter interface.

& gt after the processor processes the business logic, it will return a ModelAndView to the DispatcherServlet.

ModelAndView contains the logical name of the view and model data information.

& gtDispatcherServlet completes the resolution of logical view names to real view objects with the help of viewresolerer.

& gt After obtaining the real view object view, the DispatcherServlet uses this view to present the model data in ModelAndView.