SSH 配置struts2;拦截器不起作用
在struts.xml中的配置如下:<interceptors><interceptorname="accessInterceptor"class="intercepto...
在struts.xml中的配置如下:
<interceptors>
<interceptor name="accessInterceptor" class="interceptor.AccessInterceptor" />
<interceptor-stack name="mydefault">
<interceptor-ref name="accessInterceptor">
<param name="includeMethods">searchfavproject</param>
</interceptor-ref>
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="mydefault"></default-interceptor-ref>
<global-results>
<result name="noaccess">/noaccess.jsp</result>
</global-results>
<!--用户内容-->
<action name="login" class="LoginAction" method="login">
<result name="success">index.jsp</result>
<result name="fail">login.jsp</result>
</action> 展开
<interceptors>
<interceptor name="accessInterceptor" class="interceptor.AccessInterceptor" />
<interceptor-stack name="mydefault">
<interceptor-ref name="accessInterceptor">
<param name="includeMethods">searchfavproject</param>
</interceptor-ref>
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="mydefault"></default-interceptor-ref>
<global-results>
<result name="noaccess">/noaccess.jsp</result>
</global-results>
<!--用户内容-->
<action name="login" class="LoginAction" method="login">
<result name="success">index.jsp</result>
<result name="fail">login.jsp</result>
</action> 展开
2个回答
展开全部
<package name="model" extends="struts-default">
<interceptors>
<!-- 定义一个包含权限控制的拦截器栈 -->
<interceptor name="authority"
class="com.demo.struts2.common.AuthorizationInterceptor" />
<!-- 定义一个包含权限控制的拦截器栈 -->
<interceptor-stack name="mydefault">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="authority" />
</interceptor-stack>
</interceptors>
<!-- 定义默认拦截器 -->
<default-interceptor-ref name="mydefault" />
<!-- 定义全局处理结果 -->
<global-results>
<result name="login">login.jsp</result>
</global-results>
<action name="address*" class="addressAction">
<result name="list">address.jsp</result>
<result name="add">address_add.jsp</result>
<result name="edit">address_edit.jsp</result>
<result name="input">address_{1}.jsp</result>
</action>
<interceptors>
<!-- 定义一个包含权限控制的拦截器栈 -->
<interceptor name="authority"
class="com.demo.struts2.common.AuthorizationInterceptor" />
<!-- 定义一个包含权限控制的拦截器栈 -->
<interceptor-stack name="mydefault">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="authority" />
</interceptor-stack>
</interceptors>
<!-- 定义默认拦截器 -->
<default-interceptor-ref name="mydefault" />
<!-- 定义全局处理结果 -->
<global-results>
<result name="login">login.jsp</result>
</global-results>
<action name="address*" class="addressAction">
<result name="list">address.jsp</result>
<result name="add">address_add.jsp</result>
<result name="edit">address_edit.jsp</result>
<result name="input">address_{1}.jsp</result>
</action>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询