81,122
社区成员




public String intercept(ActionInvocation invocation) throws Exception {
String result = "";
String powerCode = invocation.getProxy().getActionName();
System.out.println("action名称+方法名:"+powerCode);
Map<String,Object> session = invocation.getInvocationContext().getSession();
if(session.get("MANAGER")==null){
result = "login";
}else{
result = invocation.invoke();
}
return result;
}
<package name="basePackage" namespace="/" extends="struts-default">
<interceptors>
<interceptor name="authorityInterceptor" class="com.txzw.exam.common.interceptor.AuthorityInterceptor" />
<interceptor-stack name="loginStack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="authorityInterceptor"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="loginStack"></default-interceptor-ref>
<global-results>
<result name="login">/login.html</result>
<result name="exception">/error/exception2.html</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="exception" exception="java.long.Exception"/>
</global-exception-mappings>
</package>