SSM framework construction (spring+springmvc+mybatis) 01

Insert picture description here
Insert picture description here
Insert picture description here
The picture shows a relatively complete flow chart of SpringMVC. The solid line represents the technology provided by the SpringMVC framework, which does not need to be implemented by the developer, and the dotted line represents that it needs to be implemented by the developer.

Briefly analyze the execution process

DispatcherServlet represents the front controller and is the control center of the entire SpringMVC. The user sends a request, and the DispatcherServlet receives the request and intercepts the request.

We assume that the requested url is: http://localhost:8080/SpringMVC/hello

The above URL is split into three parts:

http://localhost:8080 server domain name

SpringMVC is deployed on the web site on the server

hello means controller

Through analysis, the above url is expressed as: requesting the hello controller of the SpringMVC site on the server localhost:8080.

HandlerMapping is the processor mapping. DispatcherServlet calls HandlerMapping, and HandlerMapping finds Handler according to the request url.

HandlerExecution represents a specific Handler, its main function is to find the controller according to the url, as the above url is searched for the controller: hello.

HandlerExecution passes the parsed information to DispatcherServlet, such as parsing controller mapping and so on.

HandlerAdapter represents a processor adapter, which executes the Handler according to specific rules.

The Handler lets the specific Controller execute.

Controller returns specific execution information to HandlerAdapter, such as ModelAndView.

HandlerAdapter passes the view logical name or model to DispatcherServlet.

DispatcherServlet calls the view resolver (ViewResolver) to resolve the logical view name passed by the HandlerAdapter.

The view resolver passes the resolved logical view name to DispatcherServlet.

DispatcherServlet calls a specific view according to the view result parsed by the view parser.

The final view is presented to the user.

The first mvc program

Reprinted: https://www.cnblogs.com/999520hzy/p/13917437.html

Crazy God said notes

Guess you like

Origin blog.csdn.net/xiaoxiamimm/article/details/114447701