SpringMVC detailed flow (a)

  Spring Web MVC is a Java implementation of the type of request-driven Web MVC design pattern lightweight Web framework based on the idea that the use of MVC architectural pattern, the web layer to decouple duties, request driver refers to the use-based request - response model, the purpose of the framework is to help us simplify the development, Spring Web MVC also to simplify our daily Web development.
In contrast component-based, event-driven Web frameworks, such as Tapestry, JSF and the like.
  Spring Web MVC also serve to achieve worker mode, but can be optimized. The front controllers are the DispatcherServlet; application controller processor is actually split mapper (Handler Mapping) processor for management and resolver view (View Resolver) for View Management; page controller / action / Controller interface processor (comprising only (request, response) method) to achieve ModelAndView handleRequest (can be any of the POJO class); support localization (Locale) resolution, theme (theme) analysis and file uploads; provides a very flexible data validation, formatting, and data binding mechanism; provides a powerful configuration is greater than the convention (convention over configuration) of contract programming support.

  SpringMVC act as a control layer (Controller) in a Web application, the request distribution process.

A, Spring MVC request process

1. The overall process

 

 Specific steps:

  • First, the user sends a request to the front-end controller, the front end controller decide which page controller for processing the request and entrusted to it, i.e. before the control logic of the controller according to the request information (e.g., the URL); FIG. 1 , step 2;
  • After the page controller receives a request, the processing function, you first need to collect and bind request parameters to an object, the object is called in Spring Web MVC command object, and verified, then the command object to the commission processing business objects; after processing returns a ModelAndView (logical view of data and model name); 3,4,5 FIG step;
  • The front controller regain control, and in accordance with a logical view names returned, select the appropriate view is rendered and the data into the model in order to render the view; in the step of FIG. 6, 7;
  • The front controller again regain control, the response returned to the user, in the step of FIG. 8; the entire end point.

2. The core processes

Specific steps:

  • The first step: the controller initiates a request to the front end (the DispatcherServlet)
  • Step two: the front controller lookup request HandlerMapping Handler (can be configured according to xml, to find comments)
  • third step:

 

Guess you like

Origin www.cnblogs.com/myitnews/p/11565941.html