• 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 ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Attributes, Session and ServletContext

Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm reading HF on page 267, question 7. I had a look at the errata and this question is not there, so I'd like to know...

For question 7 the book gives as correct also answer C (Attributes bound into a session are available to any other servlet that belongs to the same ServletContext).

Now my understanding of ServletContext, is of an object at the web-app level, am I right? Because an application may have different sessions (teoretically one per user), the attributes bound to session A, let's say, are not available to session B, while an attribute bound to the ServletContext for the web-app is available from all sessions. If servletA is running in session A, and servlet B (still belonging to the same ServletContext as servlet A) is running in session B, servlet B won't have access to the attributes stored in session A.

Am I wrong?
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done for checking the errata first.
Next thing is to do a search on the forum (took me a while to spot the Search button - top right of the page).
Try this:
Every plan is a little cooler if you have a blimp. And a tiny ad.
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic