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??
And they're secret, so you couldn't tell us what they are?
In any case, different browsers handle new tabs/windows differently: it's going to be tough to do this in any meaningful way without a fairly robust framework for handling session conversations (for example, like Seam does).