0

As Title,
I close chrome and open it again but session id won't change.
But Firefox and IE work !!!!
Why?

    session = request.getSession();
    sessonId = session.getId();

    response.setContentType("text/html;charset=UTF-8");
    out = response.getWriter();
    out.print("<html><head><title>TestSession</title></head><body>");
    out.print("sessionId: "+sessonId);
    out.print("</body></html>");
    out.close();
scodec
  • 5
  • 2
  • How do you understand about user session? – LHA Jun 13 '14 at 14:27
  • Check if you have them all clearing cookies on browser close or not. – developerwjk Jun 13 '14 at 16:49
  • To Loc : session would be destroyed when browser close ? To developerwjk: After i clean , it works. But it against meaning of the session ? cos in IE or Firefox,i dont need to do it,users either – scodec Jun 14 '14 at 15:58
  • Browser handles the cookie. The cookie name in this case is JSESSIONID. When does a JSESSIONID is deleted ? JSESSIONID doesn't have an expiration date : it's a session cookie. As all session cookies, it will be deleted when the broswer is closed. If you use the basic JSESSIONID mechanism, then the session will become unreachable after you close and re-open the browser, because JSESSIONID cookie is deleted. Note that *All the tabs and windows* have to be closed to consider a browser as closed. Refer - http://stackoverflow.com/questions/16099752/session-or-cookie-confusion – Teddy Jun 16 '14 at 15:10

0 Answers0