• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Session

 
kamlesh tayade
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...)
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic