• 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

ServletContext n Session

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.)
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic