In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the implementation process of SpringMVC". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
A Spring core module
The following figure shows the core module of Spring, where the SpringMVC module is located in the Web module part of the Spring framework
II. Principle of SpringMVC implementation
The following figure shows a more complete flow chart of SpringMVC. The solid line represents the technology provided by the SpringMVC framework and does not need to be implemented by developers, while the dotted line indicates that it needs to be implemented by developers.
A brief analysis of the implementation process:
1.DispatcherServlet stands for the front controller and is the control center of the entire SpringMVC. The user sends the request, and the DispatcherServlet receives the request and intercepts the request
Let's assume that the requested url is:
Http://localhost:9999/SpringMVC/input-product
As shown above, the url is divided into three parts:
Http://localhost:9999 server domain name
SpringMVC is deployed on the server (web site on http://localhost:9999))
Input-product represents controller
Through the analysis, the url above is expressed as: request the input-product controller of the SpringMVC site located on the server localhost:9999
2.HandlerMapping is a processor map. DispatcherServlet calls HandlerMapping,HandlerMapping to find Handler according to the request url
3.HandlerExecution represents a specific Handler, and its main function is to find the controller according to the url. As mentioned above, the url is found as follows: input-product
4.HandlerExecution passes the parsed information to DispatcherServlet, such as parsing controller mapping, etc.
5.HandlerAdapter stands for processor adapter, which executes Handler according to specific rules
6.Handler lets the specific Controller execute
7.Controller returns specific execution information to HandlerAdapter, such as ModelAndView
8.HandlerAdapter passes the view logical name or model to DispatcherServlet
9.DispatcherServlet calls the view parser (ViewResolver) to resolve the logical view name passed by HandlerAdapter
10. The view parser passes the parsed logical view name to DispatcherServlet
11.DispatcherServlet calls the specific view according to the view result parsed by the view parser.
twelve。 The final view is presented to the user.
Three SpringMVC core components (1) DispatcherServlet
DispatcherServlet is the so-called SpringMVC front-end controller. As the control center of the entire SpringMVC, the related UML is as follows:
(2) HandlerMapping
HandlerMapping is mainly used to parse the request url, parse out the controller, and then map the controller. There are 16 related classes.
The following is the UML diagram of HandlerMapping
(3) HandlerAdapter
HandlerAdapter mainly dispatches Controller to deal with business logic and so on. There are 6 related classes.
The following is the UML of HandlerAdapter:
(4) ViewResolver
The main function of the ViewResolver interface is to parse the logical view name passed by DispatcherServlet and pass the parsed result back to DispatcherServlet. There are 19 related classes or interfaces that implement this interface.
The following are the main UML of ViewResolver:
This is the end of the content of "how the SpringMVC execution process is". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.