tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abhishek reddy" <abhishek.c1...@gmail.com>
Subject problem with sessions
Date Fri, 27 Jun 2008 06:05:44 GMT
hi every one,

i have a jsp page, once the user logged in iam creating a session in
the jsp page.When the user logged out iam invalidating the session.

when two users logged in, and if one user logged out, the other user
session is also getting invalidated.I dont want this to happen i.e.
evethough the first user logged out second can continue his work.

Can any one tell me how to solve this problem?

here is the code..

once the user logged in, he will move to session.jsp page

session.jsp page

    code:


    <div align='left'><a href="logout.jsp">Logout</a>    <a
href="compose.jsp">Compose</a></div>
    <BR>
    <%
    out.println("Is session new ?"+session.isNew()+"<BR>");
    out.println("session id="+session.getId());
    session.setAttribute("check","check");
    %>



once the user click the logout link, he will be logged out and session
will be invalidated

logout.jsp page

    code:


    <%
    session.invalidate();
    out.println("Session Invalidated..");
    %>



here is the compose page, here iam checking the varaibale set in
session.if it is null iam forwarding back to login page.

    code:

     <%
    String check=(String)session.getAttribute("check");
    if (check==null)
    {		
    	%>
    	<jsp:forward page="slogin.jsp">	
    	<jsp:param name="memid" value="" />
    	</jsp:forward>
    	<%
    }
    else
    {
    	out.println("Session exists proceed to do the work");
    }
    %>


the problem comes when i open a new window from an existing window.

i.e. for example , i have opened a new window and typed the login page url.
now i opened another window from an exisitng window using control+N option.
like wise i opened three windows.

So, when i open the windows in this fashion, session created in the
main window will be same in all the windows that opened thru control+N
option.

So, when the user logged out from any one of the windows, session will
be invalidated in all the windows..

tell me how to sort this problem.
-- 
Abhishek

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message