Struts自定义拦截器为什么没执行就直接跳转了
发布网友
发布时间:2022-04-30 17:05
我来回答
共1个回答
热心网友
时间:2022-06-28 03:01
*配置是不是有问题:给你个配置的例子:
<package namespace="/" name="userManager"
extends="struts-default">
<!-- * -->
<interceptors>
<interceptor name="securityInterceptor" class="org.itfuture.interceptor.SecurityInterceptor"></interceptor>
<interceptor-stack name="default">
<!-- 自定义*-->
<interceptor-ref name="securityInterceptor"></interceptor-ref>
<!--— 必须引用struts默认的* ———>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="default"></default-interceptor-ref>
<default-action-ref name="index"></default-action-ref>
<!-- 全局结果集 -->
<global-results>
<result name="login">/login.jsp</result>
</global-results>
<!-- loginAction -->
<action name="login" class="org.itfuture.hr.action.UserAction">
<result name="index">/WEB-INF/hr/index.jsp</result>
<result name="adminIndex">/WEB-INF/hr/user-list.jsp</result>
<result name="input">/login.jsp</result>
</action>
<!-- userAction -->
<action name="user" class="org.itfuture.hr.action.UserAction">
<result name="input">/regist.jsp</result>
<result name="updateInput" type="redirectAction">login</result>
<result name="update">user!list</result>
<result name="list">/WEB-INF/hr/user-list.jsp</result>
<result name="logout">/login.jsp</result>
</action>
<!-- registAction -->
<action name="regist" class="org.itfuture.hr.action.UserAction">
<interceptor-ref name="default"></interceptor-ref>
<interceptor-ref name="token"></interceptor-ref>
<result name="invalid.token">/recommitErr.jsp</result>
<result name="input">/regist.jsp</result>
<result name="update" type="redirect">user!list</result>
<result name="regist" type="dispatcher">/login.jsp</result>
<result>/login.jsp</result>
</action>