读书人

struts2关于session有关问题

发布时间: 2012-01-11 22:28:46 作者: rapoo

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

读书人网 >J2EE开发

热点推荐