在我的 Struts 应用程序中,一旦用户登录,我需要使当前会话无效并创建一个新会话。我使会话无效
getHttpServletRequest().getSession().invalidate();
我创建了一个新会话
getHttpServletRequest().getSession(true);
这里的问题是在上面我尝试访问getSession()它给出状态无效异常之后;HttpSession是无效的。
getSession()返回一个地图,在我的动作类中我实现SessionAware了setSession(Map session).
编辑:以下是例外
Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: HttpSession is invalid
java.lang.IllegalStateException: HttpSession is invalid
所以,我认为问题是 StrutsgetSession()仍然引用我已经失效的会话。
如何让 StrutsgetSession()引用我创建的新会话?