| Author |
Servlet Session
|
kamlesh tayade
Ranch Hand
Joined: Sep 21, 2005
Posts: 34
|
|
|
I want to know about what happen for session if one page contan button which on click pop-up a new window. At this condition is session break or still open.
|
Kamlesh
Be oN edGE SCJP 1.4, on edGE for SCWCD 1.4
|
 |
Anupam Sinha
Ranch Hand
Joined: Apr 13, 2003
Posts: 1088
|
|
|
Are you refering to a pop up window. Then yes a servlet session is still maintained even in the popup window.
|
 |
Rodrigo Alvarez
Ranch Hand
Joined: Apr 10, 2006
Posts: 75
|
|
Hi, The session state does not depend on the browser, it is stored on the server-side and identified with a JSESSIONID identifier. When the browser sends subsequents requests, it sends this identifier as well to tell the servler which session this request is part of. So you can close some or all your browser windows, it does not affect the session state. However, if a session is inactive for too long, that is, if the server does not receive any new request from this client for too long period, the servlet can decide to automatically invalidate the session. This is configured in HttpSession.setMaxInactiveInterval(int value) or in the DD in the <session-timeout> element (but pay attention to the units...)
|
It is a mistake to think you can solve any major problems just with potatoes.<br />--Douglas Adams
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Simon Alvarez: .... So you can close some or all your browser windows, it does not affect the session state. ....
Closing all of your browser windows will affect your session state in that you will no longer have access to it. The browser stores the JSESSIONID in memory. If you close all instances of it, then any new instances will not have that ID. Your next hit to the server will start a new session. Your larger point is true. Unless there is a bug in the browser (MSIE 4 or 5 had an issue with this), all popups and tabs will operate under the same session as the original window.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: Servlet Session
|
|
|