springMVC schematics:
springMVC execute schematics:
Preparation, after the aid maven import dependence, registered DisPatchServlet in web.xml.
There are four core springMVC: front-end controller processor mapping processor adapter view resolver
A brief analysis of the implementation process
-
It represents DispatcherServlet front controller, the whole SpringMVC control center. Requesting user, DispatcherServlet receives the request and interception request.
- We assume that the request url is: HTTP: // localhost : 8080 / SpringMVC / the Hello
- As url split into three parts:
- HTTP: // localhost : 8080 Server domain
- SpringMVC deployed on the server's web site
- hello indicates that the controller
- Analysis, as described above url: Request a server located localhost: hello controller on site SpringMVC 8080.
- HandlerMapping processor mapping. DispatcherServlet call HandlerMapping, HandlerMapping url look Handler upon request.
- HandlerExecution shows a specific Handler, its main role is to find a controller according to url, url be searched as controller: hello.
- HandlerExecution transmitting the analysis information to DispatcherServlet, mapping controller resolver.
- HandlerAdapter adapter indicates that the processor, which performs Handler to specific rules.
- Handler let specific Controller to perform.
- Controller The specific implementation information back to HandlerAdapter, such ModelAndView.
- The view logic HandlerAdapter or model name passed to DispatcherServlet.
- DispatcherServlet call the view resolver (ViewResolver) to resolve the logical view name HandlerAdapter transfer.
- View resolver resolves the logical view name passed DispatcherServlet.
- According DispatcherServlet view results view parser, call the specific view.
- The final view presented to the user.
Content Sources https://blog.kuangstudy.com/index.php/archives/311/ blogger, please contact delete infringement