首页 > 其他 > 详细

Struts2拦截器Interceptor执行顺序理解

时间:2016-01-11 16:28:37      阅读:172      评论:0      收藏:0      [点我收藏+]

invocation.invoke()方法是拦截器框架的实现核心,通过确定invocation.invoke()方法执行位置,来实现Action执行前后处理操作,在invocation.invoke()方法之前的代码将依据配置中拦截器顺序依次执行,直到走完拦截器后再执行invocation.invoke()方法调用Action,然后再依据配置中拦截器顺序反向执行invocation.invoke()方法后的代码,直到走完拦截器

如果我们有一个interceptor-stack的定义如下: 

Xml代码  
<interceptor-stack name="xaStack">   
  <interceptor-ref name="thisWillRunFirstInterceptor"/>   
  <interceptor-ref name="thisWillRunNextInterceptor"/>   
  <interceptor-ref name="followedByThisInterceptor"/>   
  <interceptor-ref name="thisWillRunLastInterceptor"/>   
</interceptor-stack>   


那么,整个执行的顺序大概像这样: 


技术分享

Struts2拦截器Interceptor执行顺序理解

原文:http://www.cnblogs.com/hujiapeng/p/5121610.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!