首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

struts2关于session有关问题

2012-01-11 
struts2关于session问题我在action中ActionContext.getContext().getSession().put(“”,“”)设置session,问

struts2关于session问题
我在action中
ActionContext.getContext().getSession().put(“”,“”)设置session,
问题是如何设置session持续时间
有没有servlet中的那个方法可以调用?

[解决办法]
方法一:
在使用了struts2框架的任何地方使用
ServletActionContext.getRequest().getSession().setMaxInactiveInterval(xxx);

方法二:
在Action中定义一个HttpServletRequest的成员对象req;
Action类实现ServletRequestAware接口,实现其中的方法;
在实现的方法中编写: req=方法参数;
然后在该Action中任何需要用到Session的地方使用req.getSession()......
[解决办法]

探讨

方法一:
在使用了struts2框架的任何地方使用
ServletActionContext.getRequest().getSession().setMaxInactiveInterval(xxx);

方法二:
在Action中定义一个HttpServletRequest的成员对象req;
Action类实现ServletRequestAware接口,实现其中的方法;
在实现的……

[解决办法]
探讨

方法一:
在使用了struts2框架的任何地方使用
ServletActionContext.getRequest().getSession().setMaxInactiveInterval(xxx);

方法二:
在Action中定义一个HttpServletRequest的成员对象req;
Action类实现ServletRequestAware接口,实现其中的方法;
在实现的……

[解决办法]
http://zhanjun.iteye.com/blog/1065954

热点排行