• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Context

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HFJS,Page 276,Chapter 6

Q7. Which statements about the session attributes are true?

One of the answers is :
"Attributes bound to a session are availible to any other servlet that belongs to the same Servlet Context and handles a request identified as being part of the same session"

But ,we have read in the earlier chapters that there is just one ServletContext per servlet,then how can it be shared between multiple servlets?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's check out the javadocs of the ServletContext class:
There is one context per "web application" per Java Virtual Machine.

Maybe re-read the section where you got the impression there is one context for each servlet.
 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yes you are right
thanks !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic