Spring 3.x MVC Entry 1-overall MVC Workflow

Source: Internet
Author: User

 

Lifecycle of spring MVC

Before using spring MVC, we must understand the spring MVC process, for example:

 

See some previous instructions: (The handlermapping, handleradapter, handlerexceptionresovler, and viewresolver described below have an order attribute, because each of these interfaces can register multiple implementations, order indicates their execution order. The smaller the order, the more advanced the execution. Generally, the first execution will not be executed after matching)

Dispatcherservlet: the front-end controller of spring MVC that takes over requests from the client.

Handlermapping: dispatcherservlet uses it to process the ing between client requests and various controller processors.

Handleradapter: handlermapping will call the method to be executed in the Controller Based on it

Handlerexceptionresolver: In the spring MVC processing process, if an exception is thrown, it will be handed over for exception processing.

Viewresolver: handleradapter packs the call return values in the controller into modelandview. viewresolver checks the view. If the view is a string, it processes the string and returns a real view, if a view is a real view, it will not be handed over to it for processing. Why can a view be a string or a view? The following will explain how it works.

View: corresponds to V in MVC. This interface has only one render method for View display.

Modelandview solves the doubts about viewresoler or the image below. The view attribute in this class is of the object type. It can be a view name or an actual view, we can see the source code clearly.

Private object view;

 

Public void setviewname (string viewname ){

This. view = viewname;

}

Public String getviewname (){

Return (this. View instanceof string? (String) This. View: NULL );

}

Public void setview (view ){

This. view = view;

}

Public View getview (){

Return (this. View instanceof view? (View) This. View: NULL );

}

Spring MVC Flowchart

If the image is incomplete or cannot be viewed clearly, click the following link. Because the image is too large, the process entry starts from the client at the top of the center.

Http://pic002.cnblogs.com/images/2012/267998/2012010623530925.png

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.