Home  >  Article  >  Java  >  What is springmvc workflow

What is springmvc workflow

hzc
hzcOriginal
2020-06-15 15:40:494062browse

What is springmvc workflow

What is the workflow of springmvc:

1. Springmvc working principle diagram

What is springmvc workflow

2. Springmvc workflow

1. The user sends a request to the server. This request will first go to the front-end controller DispatcherServlet (also called the central controller) .
2. DispatcherServlet will call the HandlerMapping processor mapper after receiving the request. From this, we know which Controller should handle the request (the Controller is not called, just known)
3. DispatcherServlet calls the HandlerAdapter processor adapter to tell the processor adapter which Controller should be executed
4. The HandlerAdapter processor adapter executes the Controller and gets the ModelAndView (data and view), and returns it to the DispatcherServlet
5. The DispatcherServlet hands the ModelAndView to the ViewReslover view parser for analysis, and then returns the real view.
6. DispatcherServlet fills the model data into the view
7. DispatcherServlet responds the results to the user

3. Component description

  • DispatcherServlet: The front-end controller, also called the central controller, is the control center for the entire request response, and the calls of components are uniformly scheduled by it.

  • HandlerMapping: Processor mapper, which maps to the corresponding back-end processor Handler based on the URL visited by the user. That is to say, it knows the back-end processor that handles the user's request, but it does not execute the back-end processor, but tells the central processor about the processor.

  • HandlerAdapter: Processor adapter, which calls methods in the back-end processor and returns a logical view ModelAndView object.

  • ViewResolver: View resolver, which resolves ModelAndView logical views into specific views (such as JSP).

  • Handler: Back-end processor, which handles specific user requests, is the Controller class we wrote.

Recommended tutorial: "java tutorial"

The above is the detailed content of What is springmvc workflow. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn