Monday, February 25, 2008

Struts2 - Session Invalidation

Hi all,

Can somebody please tell me how can I invalidate a session in struts2 .
I tried the following ,

if (session instanceof org.apache.struts2.dispatcher.SessionMap) {

try {

((org.apache.struts2.dispatcher.SessionMap)

session).invalidate();

} catch (IllegalStateException e) {

logger.error(e);

}

}

But still I can go to the pages in my web project and do the operations. Can somebody please suggest me a solution for this.



  • Reply 1.

try

this

((org.apache.struts2.dispatcher.SessionMap)

ActionContext.getContext().getSession()).invalidate();

  • Reply 2

HI ,

I think it do not remove the data in the session after we invalidate it.

So do you have any idea of removing the data in the session.



  • Reply 3.

((org.apache.struts2.dispatcher.SessionMap)

> ActionContext.getContext().getSession()).clear();

It might have been quicker to look up the JavaDocs.




No comments: