File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes session object 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 » Java » Servlets
Bookmark "session object" Watch "session object" New topic
Author

session object

sagar shiraguppi
Ranch Hand

Joined: Jul 16, 2007
Posts: 74
I am creating session object in my servlet program ,, but when I make a request to a servlet by opening 2 browser it is taking as only one session object.. It is happening only in my latop, in other places if I make a request from 2 browser 2 session objects are getting created, I am using session.getId() to check the ID of session,

Please help me thanks
Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247

Internally JSESSIONID cookie is passed in each request to Web Server to identify the session object exclusively allocated for the Client...

If you open a new window or new tab from the existing browser parent window, same JSESSIONID is passed... So it will refer to the same session object...

When you do open a separate new Browser window, a new request is created to the web server and different JSESSIONID is created by Web server and sends as Cookie to the Client...Then, JSESSIONID cookie is sent at subsequent requests to the Server


SCJP 6 [SCJP - Old is Gold]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Different browsers handle new windows differently; some create new sessions, some don't, some are configurable to do either.
sagar shiraguppi
Ranch Hand

Joined: Jul 16, 2007
Posts: 74
Thank you
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

sagar shiraguppi wrote:I am creating session object in my servlet program ,, but when I make a request to a servlet by opening 2 browser it is taking as only one session object.. It is happening only in my latop, in other places if I make a request from 2 browser 2 session objects are getting created, I am using session.getId() to check the ID of session,

Please help me thanks

I agree with David. But, why is this? Is this really happening?


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

It is happening only in my latop only


whats your Laptop company and its configuration ?? just kiding .


Save India From Corruption - Anna Hazare.
sagar shiraguppi
Ranch Hand

Joined: Jul 16, 2007
Posts: 74
yes it is happening with only my laptop, i tried with other laptop who are running on Vista, but only in my laptop this problem, other than this program no issues with any other program, I m still not clear why not only one session is created when I open two browser of same vendor and send a request, If I open say one chrome browser and other IE and sends the request two session are getting created understandably.. But issue is with same two browser and only one session object..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session object