Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The execution process of SpringMVC

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

A request matches the request mapping path of the front-end controller DispatcherServlet (specified in web.xml), and the WEB container transfers the request to DispatcherServlet for processing

After receiving the request, DispatcherServlet will give the request information to the processor mapper (HandlerMapping)

HandlerMapping finds the Handler that matches the url according to the user's url request, and returns an execution chain

DispatcherServlet then requests the processor adapter (HandlerAdapter) to call the corresponding Handler for processing and return the ModelAndView to DispatcherServlet

DispatcherServlet parses the ModelAndView request ViewReslover (view parser) and returns a specific View

DispatcherServlet renders the view of View (that is, populating the model data into the view)

DispatcherServlet responds to the page to the user

Component description:

DispatcherServlet: front-end controller

The user request arrives at the front-end controller, which is equivalent to the cquoise Servlet in mvc mode, which is the center of the whole process control.

It calls other components to deal with the user's request, and the existence of dispatcherServlet reduces the coupling between components.

HandlerMapping: processor mapper

HandlerMapping is responsible for finding Handler or processor according to user request url. Springmvc provides different mappers to implement different mapping methods.

For example: configuration file mode, implementation interface mode, annotation mode and so on.

Handler: processor

Handler is the back-end controller following the DispatcherServlet front-end controller. Handler processes specific user requests under the control of DispatcherServlet.

Because Handler involves specific user business requests, programmers are generally required to develop Handler according to business requirements.

HandlAdapter: processor adapter

Processors are executed through HandlerAdapter, which is an application of the adapter pattern, and more types of processors can be executed by extending adapters.

ViewResolver: view parser

View Resolver is responsible for generating the View view of the processing result. View Resolver first parses the logical view name into the physical view name, that is, the specific page address.

Then generate the View view object, and finally render the View to display the processing results to the user through the page.

View: view

The springmvc framework provides support for many View view types, including jstlView, freemarkerView, pdfView, and so on. Our most common view is jsp.

In general, we need to display the model data to the user through the page through the page tag or page template technology, and the programmer needs to develop the specific page according to the business needs.

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report