struts2拦截器不起作用
来源:互联网 发布:淘宝里的金牌卖家 编辑:程序博客网 时间:2024/06/07 22:45
struts.xml 中
<interceptors>
<interceptor name="login" class="com.lz.interceptor.CheckLoginInterceptor"/>
<interceptor-stack name="teamwareStack">
<interceptor-ref name="login"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
实现类:
package com.lz.interceptor;
import java.util.Map;
import com.lz.action.UsersAction;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
public class CheckLoginInterceptor extends AbstractInterceptor {
public static final String LOGIN_KEY = "login";
@Override
public String intercept(ActionInvocation arg0) throws Exception {
Object action = arg0.getAction();
if (action instanceof UsersAction) {
return arg0.invoke();
}
Map<String, Object> session = arg0.getInvocationContext().getSession();
String login = (String)session.get(LOGIN_KEY);
if(login != null && login.length() > 0){
return arg0.invoke();
} else{
return "error";
}
}
}
- struts2拦截器不起作用
- struts2.0上传拦截器不起作用
- Struts2 文件上传fileUpload拦截器不起作用
- springboot配置拦截器,不起作用
- 【Struts2】Struts2中拦截器
- struts2拦截器
- Struts2拦截器
- struts2.0拦截器
- struts2.0 拦截器
- struts2拦截器学习
- struts2 拦截器
- Struts2拦截器(Interceptor)
- struts2.0拦截器
- 用上struts2拦截器
- struts2拦截器简介
- Struts2:拦截器概述
- Struts2拦截器(Interceptor)
- struts2 拦截器
- 历史之外,地理之中
- 简单的递推模拟:How many days?
- (改错)5.4poj2965玛雅历1
- hdu 2837 Calculation 数论
- (改错)5.4poj2965玛雅历2
- struts2拦截器不起作用
- 关闭myeclipse8.5 打开时自动更新
- 学习知识之多线程
- nginx 的信号控制
- applicationContext.xml文件中的异常: Attribute : name The name of the property, following JavaBean naming c
- 反汇编基本原理与x86指令构造
- 用maven创建基于wink的rest服务-传送文件(字符串和字节数组)(一)
- 基于VideoInput的摄像头操作类
- backbone实例todos分析