• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Head First Question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks,
i was solving the problems of Head First chapter 6 questions, but one of the options does not seem to be right for me.

Head First is saying:

"Attributes bound into a session are available to any other servlet that belongs to the same ServletContext"

Well this seems to be as wrong statement, but may be I am missing something.
Please help me understand why this statement is right? According to me ServletContext's are not specific to session, and it should not be possible for a session
to reach to another session's attributes.

Thanks in advance.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike, welcome to javaranch.

The statement means that attributes in a session are not available to any servlet outside the ServletContext. You are right that session attributes can't be inter-referenced between sessions. But the point is, if I set a session attribute in servlet1, then any other servlet (lets say servlet2) which gets called on the same session can access that attribute only if servlet1 and servlet2 are in same servlet context...
 
Mike Terry
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ankit,
It makes sense with your explanation.
Thanks alot.
 
Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic