• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Session Scope

 
Ravi Bansal
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not correct.
 
Mateus Lucio
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic