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

Question on answer in HeadFirst Servlets & JSP

 
Bart Allen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 6 Mock exam, page 267 question 7.

Which statements about session attributes are true?

The answers indicate 3 correct answers, two of which I agree with.
The one I don't agree with (or more to the point don't understand) is:

C. Attributes bound into a session are available to any other servlets that belong to the same ServletContext.

Wouldn't this only be true if the attempt to access the session attribute was made in the same session? If a new client starts up a new session, even though that person is using the same servlets, will not have access to session attributes, even though that person is in the same ServletContext -> right?
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, this question is one that we're allowing people to score themselves correct whether they check this answer as true or not, because it depends on how you interpret it. It needed better wording for sure.

The language is not *technically* incorrect, but it really does need a little more qualification to make it completely right, because there must be a *mechanism* for that web component to gain access to the session, but the point is that *any* part of the web app with the same context *can* get access, assuming they are somehow (and we don't care how) associated with that session.

So, if you said *no*, give yourself a point anyway. If you said *yes*, because you interpreted it the way we intended it (but were not clear enough!), then give yourself a point as well.

cheers,
Kathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic