Hi All,
I have a problem regarding
java session management.
i have created one web application in which i want if user login from one browser instance and opens another instance of same browser and logs in from that then user should be logged out from previous window. I am using Mozzila 5.0.
Here is what i am doing while creating session in LoginServlet.java
session = request.getSession(false); //return session if already exists
System.out.println("Session object: "+session);
if(session != null)
{
System.out.println("Session ID Old: "+session.getId());
session.invalidate(); //invalidate the session if already exists
}
session = request.getSession(true); //Create new session
System.out.println("Session ID New: "+session.getId());
Second and third System.out.println() statements giving the same session id.
This way only the information stored in session when user was logged in from first window is replaced with the new information stored in second window login, but the user is not logged in from the first window though its role is changed suppose in first window he logged in using nornal user login and in second window he logged in as admin user then in first window users role is getting changed to Admin.
Please help me out how i can log the user out from first window if he logs in from second window.
Thanks in advance...