The order in which the Action and the interceptor are executed

Source: Internet
Author: User

Learn notes for the action before the interceptor or after the interceptor. from

After the teacher's test ... Add breakpoints to each interceptor ...
Know:

The Action is executed at the time of the visit.

And the action is created before the params interceptor is executed.

So the conclusion is:

Action must precede the params interceptor. And the interceptor params is in the default-stacks position:

            <interceptor-stack name= "Defaultstack" > <interceptor-ref name= "Exception"/>
                <interceptor-ref name= "Alias"/> <interceptor-ref name= "ServletConfig"/> <interceptor-ref name= "i18n"/> <interceptor-ref name= "Prepare"/> <inter Ceptor-ref name= "Chain"/> <interceptor-ref name= "Scopedmodeldriven"/> <interce Ptor-ref name= "Modeldriven"/> <interceptor-ref name= "FileUpload"/> <intercepto  R-ref name= "checkbox"/> <interceptor-ref name= "MultiSelect"/> <interceptor-ref Name= "Staticparams"/> <interceptor-ref name= "Actionmappingparams"/> <intercep
                Tor-ref name= "params" > <param name= "excludeparams" >^action:.*,^method:.*</param> </interceptor-ref> <interceptor-ref name= "Conversionerror"/> <interceptor-ref name= "valid ation "> <param name=" excludemethods ">input,back,cancel,browse</param> & lt;/interceptor-ref> <interceptor-ref name= "Workflow" > <param name= "Exclud Emethods ">input,back,cancel,browse</param> </interceptor-ref> <intercept Or-ref name= "debugging"/> <interceptor-ref name= "deprecation"/> </interceptor-stac K>
so the conclusion:

Action must precede the params interceptor.

But some teachers say the action should first be loaded before the interceptor ....

So, all I know now is before the params, in the end, all the default interceptors are unknown. If there is more detailed, please share to me, thank you. Add:

Now I understand the order of the action and the Interceptor. I was doing struts upload when I know, if need to see my uploaded articles. can go to see (the attached link), remember is to see my struts2.xml configuration parameters.
http://blog.csdn.net/pengdongneng/article/details/50977705

Interceptors are useful every time a action is requested. That is, every request for an action in each struts.xml, the action is created first, and then the default defaultstack. So

Action precedes the Interceptor, not just the params interceptor. Summary: server startup, Interceptor Creation-"Initialize init access when the action is created and then entered into the interceptor in the Intercept method after the method in action, such as: Execute,getter ()

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.