2

私の 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()がまだ無効にしたセッションを参照していることです。

getSession()作成した新しいセッションを参照するように Struts を作成するにはどうすればよいですか?

4

1 に答える 1