Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in Session Attributes (HFSJ)  RSS feed

 
Harini Kaushik
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi All,

Am preparing for SCWCD Exam.
I have a doubt regarding one Session Attribute question in Mock Exam chapter6 of HFSJ.

Question : Which statements about Session Attributes are true?
Answer: ONe of the answer is "Attributes bound into session are available to any other servlet that belongs to same Servlet Context" -- Am pretty confused of this statement..

My doubt is
Servlet Context is for entire Web Application and Session Attributes are bound to particular session for a request..
Then how 'll it be accessible by (or available to) all other servlets in the Servlet Context?

Can any one clarify my doubt?
Appreciate any help..

Thanks,
Harini
 
Rob Spoor
Sheriff
Posts: 21114
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same session can be used for requests to many servlets of your wep application. So if you first make a request to servlet A, and A sets a session attribute, that attribute is available for you if you then make a request to servlet B (provided the session hasn't timed out).
 
Harini Kaushik
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh yeah.. ok.. Thanks Rob
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!