阅读背景:

Struts2-MethodFilterInterceptor(转)

来源:互联网 

一,要配置struts.xml文件。

<struts>  
    <package name="methodFilter" extends="struts-default">  
        <interceptors>  
            <interceptor name="myInterceptor11" class="com.jadyer.interceptor.MyInterceptor11">  
                <param name="hello">world</param>  
            </interceptor>  
            <!-- <param name="hello">world</param>表示为拦截器增加一个名为hello值为world的属性 -->  
            <!-- 但是这里也只是为hello赋了初值为world。如若在下面的<action/>中配置使用该拦截器的时候 -->  
            <!-- 增加了<param name="hello">welcome</param>,则最后拦截器类中hello属性值即为welcome -->    
            <interceptor name="myInterceptor33" class="com.jadyer.interceptor.MyInterceptor33">  
                <param name="includeMethods">test,abc</param>  
            </interceptor>  
        </interceptors>  
        <action name="methodFilter" class="com.jadyer.action.MethodFilterAction" method="test">  
            <result name="success">/methodFilterResult.jsp</result>  
            <interceptor-ref name="defaultStack"/>  
            <interceptor-ref name="myInterceptor11"/>    
            <interceptor-ref name="myInterceptor33">  
                <param name="includeMethods">abc</param>  
            </interceptor-ref>  
        </action>  
    </package>  
</struts>  <struts>  
    <package nam



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: