"Java.Spring.MVC" builds Web applications using Spring MVC __java

Source: Internet
Author: User
process of Spring MVC request

The request is assigned to the controller by Dispatcherservlet (determined according to the processor mapping). After the controller finishes processing, the request is sent to a view (determined by the view parser) to render the output:



(1) The first step is spring's dispatcherservlet. All requests for Spring MVC pass a front-end controller Servlet--dispatcherservlet;dispatcherservlet task to send the request to the spring MVC controller; (2) The controller is a spring component for processing requests, and Dispatcherservlet queries a multiple processor mapping handlermapping to determine which controller the request should be sent to handler Handlermapping to make decisions based on the URL information carried by the request; (3) After the controller handler is selected, Dispatcherservlet sends the request to the selected handler; The handler is reached, The request waits for handler to process the information in the request (in fact, the handler itself handles only a small amount of processing work, and instead delegates the business logic to one or more service objects); (4) handler after the completion of the logical processing, will produce some information model, This information needs to be returned to the user and displayed on the browser; the last thing handler does is package the Modle data and identify the name of the view that is used to render the output. and sends the request along with the model and view name back to Dispatcherservlet; (5) The name of the view passed to Dispatcherservlet does not directly represent a particular JSP; it simply passes a logical view name, This name will be used to find a real view of the resulting results. Dispatcherservlet will use Viewresolver to match the logical view name to a specific view implementation, perhaps not a JSP; (6) Finally, the model data is delivered to the View,view using the model data rendering output, and pass the response object to the client through this output;

Introduction to Spring MVC

The M- Model map is automatically converted to the appropriate format, such as the request attributes in JSP, the template model in velocity.


integrating spring in other MVC frameworks

Start a spring root application context by configuring Contextloaderlistener , and then get the spring context through ServletContext:

Webapplicationcontext CTX = Webapplicationcontextutils.getwebapplicationcontext (Request.getservletcontext ());



Related Article

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.