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 Doubt in Session Scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
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: 61092
    
  66

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: 61092
    
  66

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