struts2拦截器

顺便向大家提个醒,使用自定义的Interceptor时,一定要定义一个Interceptor栈,定义你自己的拦截器和系统默认拦截器的调用顺序,如果直接在action中引用你自定义的拦截器,就会发现只调用了你自己的拦截器,没有调用Struts2中内置的拦截器,那样有很多功能就会运行不正常了。

 <interceptors>
   <interceptor class="com.caitong.shopping.interceptor.action.ActionPrepare" name="actionPrepare"></interceptor>
    <interceptor-stack name="pageInitStack">
     <!---->
     <interceptor-ref name="actionPrepare">
     <!---->
     <interceptor-ref name="defaultStack">
    </interceptor-ref>
    </interceptor-ref></interceptor-stack></interceptors>
<interceptor name="authorize" class="com.struts2.interceptor.AuthorizeInterceptor"></interceptor>
<!---->
<!---->

<action name="forward" class="com.struts2.RequestForward"></action>

你可能感兴趣的:(struts2拦截器)