struts2 拦截器配置

<!--以下代码放在Struts的配置文件里-->

<package name="wapMemberPackage" extends="struts-default">
        <!-- Defined myself interceptors -->
        <interceptors>
            <interceptor name="paginationInterceptor" class="com.juming.interceptor.PaginationInterceptor"/>
            <interceptor name="frontMemberInterceptor" class="com.juming.interceptor.FrontMemberInterceptor"/> //拦截器类
            <interceptor-stack name="MyDefaultInterceptor">
                <interceptor-ref name="defaultStack" />
                <interceptor-ref name="paginationInterceptor" />
                <interceptor-ref name="frontMemberInterceptor" />
            </interceptor-stack>
        </interceptors>
        <default-interceptor-ref name="MyDefaultInterceptor" />
        <global-results> //全局返回值 必须放在所有action之上
            <result name="login">/WEB-INF/jsp/template/wap/login.jsp</result>
            <result name="error">/WEB-INF/jsp/template/wap/error.jsp</result>
        </global-results>
        <action name="wapm_*" method="{1}" class="com.juming.action.frontMemberAction">
            <result name="success">/WEB-INF/jsp/template/wap/index.jsp</result>
        </action>
    </package>

原文地址:https://www.cnblogs.com/wdlove/p/4499733.html