This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Actually, it is possible to have more than one browser using the same HttpSession object. It depends on the browser and how it is opened.
Joined: Mar 01, 2005
hi kieth can i say on opening the browser for the same website by right clicking the mouse and giving open in new window wont create a new session object the request will proceed with the same session object.../
But when the user is issuing the link by opening a new browser i hope the new session will be created
correct me if i was wrong.
Joined: Sep 22, 2005
It also depends on the browser. Unfortunately I don't have the details at hand but I do know that there are differences in the way different browsers (e.g. IE, Firefox, Safari, Opera) behave with respect to whether or not new HttpSession objects are created when new browser windows are opened.
Perhaps someone else can shed some light on how the different browsers behave.
From my experience when a request originates from an already existing session in a browser. The session continues, no new session is instatiated as long as the origination of the request is from the same window.
So when yu open a new browser window by right-clicking and opening a new window the session is maintained.
I have tried this with internet explorer and with Mizilla Firefox.
SCJP 1.4, SCWCD 1.4
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler et al, Refactoring: Improving the Design of Existing Code, 1999
Scheepers de Bruin
Joined: Jul 19, 2005
Correct on the opening of a browser from the same window. I misread the "same" part. [ September 28, 2005: Message edited by: Scheepers de Bruin ]
I feel that there is no need to know, how different browsers behave with respect to sessions. Anyways, as developers we need to write a generic code and container developers should also write a generic code.
Even the servlet specification states that, NEVER assume 1 browser window = 1 session.
They say that Cookies and SSL certificates are all part of the browser process and NOT part of a SINGLE BROWSER.
Specification states that we(developers) should always assume that request from multiple windows can still be part of same session.