This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes Doubt in Session Scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Doubt in Session Scope" Watch "Doubt in Session Scope" New topic
Author

Doubt in Session Scope

Ravi Bansal
Ranch Hand

Joined: Aug 18, 2008
Posts: 86
I read the below sentence somewhere..

"Any object bound into a session is available to any other servlet that belongs to the same ServletContext "

Can anyone tel me if ithe above statement is correct ?

if one client sends a request to some servlet and sets some attribute in session object , then second client sends the request to same servlet (or some other servlet belonging to same servlet context) , how can a second client access attribute in the session object set by first client , as second client wil have a different session with the server.?


SCJP 5.0 94%
OCE-EJBD 90%
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

It is not correct.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mateus Lucio
Ranch Hand

Joined: Jul 27, 2006
Posts: 57
Depend on how you read it ...

An object bound to a session is available to any servlet that belongs to the same ServletContext as long as the requests are been sent by the same client.

I read it in HFSJ ... took me sometime to understand it, but i don't consider that sentence wrong, I just think it's incomplete.


Studying ...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

Almost any sentence can be made correct if you add more words or context to it. But simply as written in the original post without further info, it is not correct.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in Session Scope