aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HttpSession Object creation with mulitple browser windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HttpSession Object creation with mulitple browser windows" Watch "HttpSession Object creation with mulitple browser windows" New topic
Author

HttpSession Object creation with mulitple browser windows

Vijay Raj
Greenhorn

Joined: Apr 12, 2007
Posts: 4
Hi,

It is mentioned in HFSJ that even if an user opens multiple browser windows , they all share the same Session Object.

This works properly for FireFox ( I donno whether IE Older versions do the same)

Observation: FIREFOX
INFO: Server startup in 1078 ms
WINDOW 1
SESSION: New Session initiated, created at 1176895778968
(Refresh in same window)
SESSION: Old Session continued, created at1176895778968
SESSION: Cookie from browser is SESSIONID=3C91D4D3C52FDFC523464A60CF518352

WINDOW 2
SESSION: Old Session continued, created at1176895778968
SESSION: Cookie from browser is JSESSIONID=3C91D4D3C52FDFC523464A60CF518352


But in IE7 a new Session Object is created for every window.

Observation: IE7

INFO: Server startup in 1266 ms
SESSION: New Session initiated, created at1176889730984
(Refresh in same window)
SESSION: Old Session continued, created at1176889730984
SESSION: Cookie from browser is JSESSIONID=B80893D3E437E07117E3C6CBED44EFC0

New Window opened

SESSION: New Session initiated, created at1176889771375
(Refresh in same window)
SESSION: Old Session continued, created at1176889771375
SESSION: Cookie from browser is JSESSIONID=4AD268C2B910C72F5DBAFE34808E1B73


SCJP 1.5
Oscar Gonzalez
Ranch Hand

Joined: Mar 28, 2006
Posts: 63
Yes this is a fact, Firefox share the session, IE dont'.

So if your application needs to run in every browser you might want to use the request scope in some of your servlets/jsp
Vijay Raj
Greenhorn

Joined: Apr 12, 2007
Posts: 4
Thanks for the prompt reply , but 'IE' means all versions of IE?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

IE can have multiple windows share the same session, but the additional windows MUST be spawned from a window that is already participating in a session. By spawned, I mean the orginating window can create the other window or the user can press Ctrl+N to create a duplicate of the originating window.

Vijay, we don't have many rules around here but we do have a Naming Policy. Please review our policy and update your display name accordingly. Specifically, the name "Vijay" is only a first name and the policy requires both a first and last name. Thanks.


A good workman is known by his tools.
Sergio Tridente
Ranch Hand

Joined: Mar 22, 2007
Posts: 329

Originally posted by Oscar Gonzalez:
So if your application needs to run in every browser you might want to use the request scope in some of your servlets/jsp


This approach will not solve the problem: sharing information between multiple request of the same user.


SCJP 1.4 (88%) - SCJP 5.0 Upgrade (93%) - SCWCD 1.4 (97%) - SCBCD 5.0 (98%)
Vijay Raj
Greenhorn

Joined: Apr 12, 2007
Posts: 4
Thanks a lot to everyone ..and i have changed my name.
Xavier Anguita
Greenhorn

Joined: Apr 24, 2007
Posts: 4
I have a question for you people,

If I have a page with 2 links, and this links opens 2 new window,

how can I do that this 2 window have differents sessions between them? A map:


Example: The parent window open a child window with the session ID: 111222, then the parent window opens another child window and this still have the session ID:111222.

I try this in ie and firefox.

Thank you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: HttpSession Object creation with mulitple browser windows