This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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: 84
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: 60810
    
  65

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: 60810
    
  65

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.

 
Don't get me started about those stupid light bulbs.
 
subject: Doubt in Session Scope
 
Similar Threads
Chapter 6(Session Management) notes (HFSJ) for revision
Joining a session...session and cookies.
query related to sessions
HFSJ Chapter 6 - Mock exam Question 7
Cookie in Servlet