Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

Session Attributes question

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic