jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Can 2 session exist at the same time? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can 2 session exist at the same time?" Watch "Can 2 session exist at the same time?" New topic

Can 2 session exist at the same time?

Moses Herrada

Joined: Jan 22, 2005
Posts: 11
Can 2 http session exist at the same time? or sessions can be multiple ??
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 951

I am not getting the question is in which context. Serveral sessions are exist in container. For the user , usually there is only one session per ServletContext ( application).

It is possible that there may be more than one session per user per application, if the brwoser on the client machine is running in seperate thread for multiple windows and the user opens two different sessions.

I am also studying Servlet, so this may not be a perfect answer.

Thank you.

Narendra Dhande
SCJP 1.4

Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Narendra has it right. Each session is associated with a unique serial number, typically stored in the user's browser as a cookie. One user with multiple browser windows open may have multiple sesssions, depending on how the browser manages cookies. A single request can have only one session associated with it. The servlet API goes to great lengths to prevent interference between sessions for security reasons.
A servlet container can be managing thousands of sessions "at the same time."
I agree. Here's the link: http://aspose.com/file-tools
subject: Can 2 session exist at the same time?
It's not a secret anymore!