About SPRINGMVC Workflow I cite one of its official documents: 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/59/FA/ Wkiom1txfvlacgtxaajhu9bsd3a690.jpg "title=" 2015-02-28_163900.png "alt=" Wkiom1txfvlacgtxaajhu9bsd3a690.jpg "/>
The above picture from the macro-rough introduction of SPRINGMVC's entire work flow, concise and clear.
Let me take a look at the code from the point of view:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/59/FA/wKiom1Txf5vSVT_XAACtbHyswNQ708.jpg "title=" 2015-02-28_164251.png "alt=" Wkiom1txf5vsvt_xaactbhyswnq708.jpg "/>
Because we declared a Dispatcherservlet in Web. XML, the Tomcat initializes it when it is started.
We know that the servlet initialization method is init (), just start here and see what it's doing with initialization.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/F7/wKioL1TxgZXjYJ0fAABLd6Rmlm8047.jpg "style=" float: none; "title=" 2015-02-28_164517.png "alt=" Wkiol1txgzxjyj0faabld6rmlm8047.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/FA/wKiom1TxgIfy_91GAACoXpAluC4417.jpg "style=" float: none; "title=" 2015-02-28_164544.png "alt=" Wkiom1txgify_91gaacoxpaluc4417.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/F7/wKioL1TxgZbj14WyAABhYC3Adtc526.jpg "style=" float: none; "title=" 2015-02-28_164610.png "alt=" Wkiol1txgzbj14wyaabhyc3adtc526.jpg "/>
First, initialize
There is an Init method in Httpservletbean
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/F7/wKioL1TxggaRUrVhAANeHtZ_Ieo563.jpg "title=" 2015-02-28_164828.png "alt=" Wkiol1txggarurvhaanehtz_ieo563.jpg "/>
The Initservletbean () method is overridden in the Frameworkservlet class
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/59/F7/wKioL1Txg0-TCxxOAAK5Mq995qs185.jpg "title=" 2015-02-28_165405.png "alt=" Wkiol1txg0-tcxxoaak5mq995qs185.jpg "/>
The Initwebapplicationcontext () method in Frameworkservlet
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/FA/wKiom1Txgp_Dv-yMAAPH4tuzR0k855.jpg "title=" 2015-02-28_165507.png "alt=" Wkiom1txgp_dv-ymaaph4tuzr0k855.jpg "/>
Overriding the Onrefresh () method in the Dispatcher class
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/59/FB/wKiom1TxgwfhxPNuAANXtr2Zb_M092.jpg "title=" 2015-02-28_165657.png "alt=" Wkiom1txgwfhxpnuaanxtr2zb_m092.jpg "/>
At this point, we see Dispatcherservlet initializing a bunch of components, what the view parser, the processor mapping, and so on.
Ii. Processing of requests
Because Dispatcherservlet is inherited HttpServlet, the Doget or Dopost method is called when processing the request
Doget and Dopost methods are overridden in the Frameworkservlet class
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/F7/wKioL1Txhbiy3CK3AAKI6bkzn8k206.jpg "title=" 2015-02-28_170347.png "alt=" Wkiol1txhbiy3ck3aaki6bkzn8k206.jpg "/>
The ProcessRequest method in Frameworkservlet is like this
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/F7/wKioL1TxhjHz1GntAAV9rjx-YbU507.jpg "title=" 2015-02-28_170600.png "alt=" Wkiol1txhjhz1gntaav9rjx-ybu507.jpg "/>
It calls the Doservice method, and then the fun begins.
Dispatcherservlet rewrite the Doservice () method
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/FA/wKioL1Txiu2Rek5ZAB3ZfYgGQ7Y583.jpg "title=" Assad sends. png "alt=" wkiol1txiu2rek5zab3zfyggq7y583.jpg "/>
At this point, request processing is complete
Summarize the process:
Bind a resource to a request
Check if File upload
Find handlermappping Get Handlerexecutionchain
Call the Prehandle method of all interceptors associated with the processor in turn
Calling the Processor method
Call the Posthandle method of all interceptors associated with the processor in turn
Render View
Call the Aftercompleting method of all interceptors associated with the processor in turn
This article is from the "ten-li Rice flower" blog, please be sure to keep this source http://5880861.blog.51cto.com/5870861/1616032
SPRINGMVC processing Process