為什么攔截器沒有生效
<!-- 注冊攔截器 -->
<interceptors>
<interceptor name="auth" class="com.interceptor.AuthIntetceptor"></interceptor>
<!-- 自定義攔截器棧 -->
<interceptor-stack name="myStack">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="auth"></interceptor-ref>
</interceptor-stack>
</interceptors>
<action name="auth">
<result>manager.jsp</result>?
<result name="login">login.jsp</result>
<!-- 引用攔截器棧 -->
<interceptor-ref name="myStack"></interceptor-ref>
</action>
@Override
public String intercept(ActionInvocation invocation) throws Exception {
ActionContext context = ActionContext.getContext();
Map<String, Object> session =context.getSession();
if(session.get("loginInfo")!=null) {
String result=invocation.invoke();
return result;
}else {
return "login";
}
}
2022-03-30
2018-05-29
<result>manager.jsp</result> 應該改成
<result>/WEB-INF/page/manager.jsp</result>
2018-04-17
你是不是之前已經提交了客戶端的數據了?
2018-03-29
直接訪問auth還是可以進去!!!