Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Attributes question

 
Dan T
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 267 of HF question 7 of mock exam, it says that:

C. Attributes bound into a session are available to any other servlet that
belongs to the same ServletContext. (correct option)

By 'bound', are we talking about the method of setAttribute()? I thought attributes in the HttpSession are only available to servlets within the session iteself. And what does belong to the same ServletContext mean ?

And on page 59 of spec,

A servlet can bind an object attribute into an HttpSession implementation by name.Any object bound into a session is available to any other servlet that belongs to the same ServletContext and handles a request identified as being a part of the same session.

Thank you.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe this has been corrected in the errata for the book. search this forum for the location of the errata if you do not know it.
 
Bryan Basham
author
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Dan,

You are quite correct. The text of option C should use the whole sentence from pg 59 of the servlet spec, as you have astutely noted. And yes, this was reported in the first printing and should be fixed in the second printing.

Cheers,
Bryan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic