SPRINGMVC Request Processing Detailed

Source: Internet
Author: User

spring web mvc  process: Once it arrives, Dispatchersevlet will be responsible for distributing the request. Dispatcherservlet can be thought of as the front-end controller provided by spring, and all requests have been distributed uniformly. Before Dispatcherservlet will distribute the request to Spring controller, it is necessary to navigate to the specific controller using the handlermapping provided by spring. Handlermapping is an object that can perform a mapping between a client request and a controller. In struts, this mapping is done through the Struts-config.xml file. Spring provides several implementations for the Controller interface, such as the beannameurlhandlermapping that spring uses by default. And, simpleurlhandlermapping,commonspathmaphandlermapping. Spring controller will process the request from Dispatcherservlet. Spring's controller is similar to the action of struts and can accept httpservletrequest and httpservletresponse. Spring provides a number of implementation classes for the Controller interface, located in the ORG.SPRINGFRAMEWORK.WEB.SERVLET.MVC package. Since the controller needs to process the above request for concurrent users, it must be guaranteed and reusable when implementing the Controller interface. The controller will process the customer request, which is consistent with the role played by struts action . Once the controller has finished processing the customer request, the Modelandview object is returned to the Dispatcherservlet front-end controller. The model and view are included in the Modelandview. From a macro point of view, Dispatcherservlet is the controller for the entire Web application, and from a micro point of view, the controller is a control in a single process, and Modelandview is the model and view returned during the HTTP request. The view returned by the front-end controller can be either the logical name of the view or the object that implements the view interface. View objects can render customer response results. The models in Modelandview can be used for shadingused when dyeing view. The model can be stored with the help of a map object. If the view returned by Modelandview is only a logical name, you will need to use the spring-provided view parser (Viewresoler) to find the View object in the Web app, rendering the response result to the customer. Dispatcherservlet returns the result of the view object to a customer.


SPRINGMVC Request Processing Detailed

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.