struts2清除session的方法
来源:互联网 发布:windows编程命名规则 编辑:程序博客网 时间:2024/05/29 13:34
第一种方法(继承SessionAware类来取得session,然后用invalidate()方法清理)
public class ExitAction extends ActionSupport implementsSessionAware{
@Override
public String execute() throws Exception {
HttpServletRequest request =ServletActionContext.getRequest();
HttpSession session1 = request.getSession();
session1.invalidate();
return super.execute();
}
public void setSession(Map arg0){
}
}
//第二种方法(用ActionContext取session,然后用clear()方法清理)
public class ExitAction extends ActionSupport{
@Override
public String execute() throws Exception {
ActionContext ac = ActionContext.getContext();
Map session = ac.getSession();
session.clear();
return super.execute();
}
}
//第三种方法(一样用ActionContext取session,然后取一个Session的KEY,清除该KEY的session,这种办法可以选择性的清理你要清理的session)
public class ExitAction extends ActionSupport{
@Override
public String execute() throws Exception {
ActionContext ac = ActionContext.getContext();
Map session = ac.getSession();
session.remove("buser");
session.remove("guser");
session.remove("fuser");
return super.execute();
}
}
- struts2清除session的方法
- struts2清除session的方法
- struts2清除session的方法
- struts2清除session的方法
- Java清除session的方法
- Java清除session的方法
- jsp 清除session的方法
- 浅析清除session的几种方法
- session中清除的一些方法
- Struts2 获取WEB对象(作用域,request、application、session) 清除Session的值
- 清除jsp页面缓存、cookie、session 的各自方法
- Oracle的KILL锁表及清除session方法
- 退出登录方法,清除相关的cookies和session
- Oracle的KILL锁表及清除session方法
- 实现关闭浏览器时清除session的方法
- Struts2获取request、session的方法
- Struts2中获取Session的方法
- struts2 获取request、session的方法
- Struts2标签实现for循环
- 在jsp页面中实现类似锚点的…
- Struts2中action获取request、resp…
- struts2清除session的方法
- codeforces 404C - Restore Graph
- struts2清除session的方法
- Struts2.0页面跳转css无效问题的解…
- (转)关于struts2 hidden隐藏…
- java设置-JDK环境变量的设置 (转)
- 使用开源库 SVPullToRefresh 实现上拉加载下拉刷新
- (转)iOS UIControl 几个事件的说明
- PROPAGATION_REQUIRED
- 转:String之HibernateTemplate经典…
- <s:iterator>各种遍历用法