SPRINGMVC Request Process

Source: Internet
Author: User

The SPRINGMVC framework is a request-driven web framework that is designed with a ' front controller ' model and then distributed to the appropriate page controller for processing according to the ' Request mapping rule '.

(a) the overall process

Specific steps:

1, the first user sends the request to the front-end controller, the front-end controller according to the request information (such as URL) to decide which page controller to process and delegate the request to it, that is, the control logic of the previous controller, the figure of 1, 2 steps;

2, after the page controller receives the request, carries on the function processing, first needs collects and binds the request parameter to an object, this object in Spring Web MVC calls the command object, and validates, then delegates the command object to the business object to handle; Modelandview (model data and logical view names); 3, 4, 5 steps in the diagram;

3, the front controller retract control, and then according to the return of the logical view name, select the corresponding view to render, and the model data passed in so that the view rendering; steps 6, 7 in the figure;

4, the front controller again regain control, return the response to the user, the figure of step 8; This concludes the whole.

(ii) core processes

Specific steps:

First step: Initiating a request to the front-end controller (dispatcherservlet)

Step Two: Front controller request handlermapping find Handler ( can be found based on XML configuration, annotations)

Step Three: Processor mapper handlermapping return to the front-end controller handler,handlermapping will map the request to a Handlerexecutionchain object containing a handler processor (page Controller) object. Multiple Handlerinterceptor Interceptor objects), this policy mode makes it easy to add new mapping strategies

Fourth step: The front controller calls the processor adapter to execute the handler

Fifth Step: Processor Adapter Handleradapter will be executed according to the results of the adaptation handler

Sixth step: Handler execution completes to the adapter return Modelandview

Seventh Step: The processor adapter returns Modelandview to the front-end controller ( Modelandview is an underlying object of the SPRINGMVC framework, including model and view)

Eighth step: The front-end controller requests the view parser to do the visual analysis ( according to the logical view name resolves to a real view (JSP)), this strategy is easy to replace other view technology, only need to change the view parser to

Nineth Step: View Resolver to Front controller return view

Tenth step: Front Controller for view rendering ( View rendering populates model data (in the Modelandview object) to the request field)

11th Step: Front controller responds to user results

(iii) Summary of core development steps

1. Dispatcherservlet deployment description in Web. XML to intercept requests to Spring Web MVC

2. Handlermapping configuration, which maps the request to the processor

3. Handleradapter configuration to support multiple types of processors

Note: The processor mapping sum adapter is included in the note driver with the ease of use, and does not need to be configured separately

4, Viewresolver configuration, to resolve the logical view name to the specific view technology

5, the Processor (page controller) configuration, so as to perform functional processing

View is an interface that implements classes that support different view types (JSP, Freemarker, pdf ...). )

SPRINGMVC Request Process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.