• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext n Session

 
shweta bulbule
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how come the statement

"Attributes bound into a session are available to any other servlet that belongs to the same ServletContext."

is true???
[HFSJ page: 274, Q-7]
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shweta bulbule:
how come the statement

"Attributes bound into a session are available to any other servlet that belongs to the same ServletContext."

is true???
[HFSJ page: 274, Q-7]


Where you found this statement. This is not true. The session attributes are avilable to the thread executing any doXXX / service method which is part of the session. In distributed environment, the session is reside only in one JVM at a time, so all the request processing in the same session have same ServletContext at the point of time.

Hope it help you.

Thanks
 
shweta bulbule
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah even i thought that this statement is wrong, but ofcourse not with such gr8 explanation. the statement is marked as 1 of the correct answer in the exams at the last of each chapter.
 
suresh guru
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Even i got confused on this answer. I think the option should be "Attributes bound into a session are available to any other servlet that belongs to the same ServletContext(assume those servlets participate in session.)
 
Rodrigo Alvarez
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,


Here is the explanation from the HFSJ errata :


{274} Q7, Answer C;
Answer C left off a vital part of the sentence when it was copied from the Servlet specification.
The Servlet specification says:

'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.'

Answer C leaves off the final part of the sentence: 'and handles a request identified
as being a part of the same session.' Without this answer C is not correct.


By the way, this is not the only mistake in the book, I'd suggest you went through the entire errata at least one and correct your copy.


Cheers
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doesn't make sense to me


'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.'

Answer C leaves off the final part of the sentence: 'and handles a request identified
as being a part of the same session.' Without this answer C is not correct.


now we have two statements A and B
and we're debating on the truth value of the compoud statemet "A & B" clearly if 'A & B' has to be true, A should be true and B should be true.

it doesn't make sense saying that A is not true without B
B seems like only an addition and I really fail to see what this whole thing is about.
I would greatly appreciate clarifications on this one.
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic