posted 15 years ago
Hi All
I wanted to invalidate session on browser refresh...or on opening the same url on other tab of the browser
Whit i thought is to declare a static int in action class, and increment it every time the action class gets hit.
So if I refresh the browser, that static variable gets initialized to 0, so that if i keep a check on the variable for its value to be 0, i can actually invalidate the session.
something like this
static int ref = 0;
in processRequest of action class,
ref++;
if(ref == 1)
processRefresh(request);
public void processRefresh(HttpServletRequest request) {
HttpSession session = request.getSession(false);
if(session!=null) {
System.out.println(session);
System.out.println("session existing....and being invalidated in processor....");
session.invalidate();
}
But i'm getting some exceptions
If there is any other way, can someone help me out??
Thanks
Ravi
Thanks,
Ravi
SCJP 5.0 | SCWCD 5.0