Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ mock Exam Doubt

 
sravanthi pulukuri
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Which statements about session attributes are true? (Choose all that apply.)
A. The return type of HttpSession.getAttribute(String) is Object.
B. The return type of HttpSession.getAttribute(String) is String.
C. Attributes bound into a session are available to any other servlet that belongs to the same ServletContext and handles a request identified as being part of the same session.
D. Calling setAttribute(“keyA”, “valueB”) on an HttpSession which already holds a value for the key keyA will cause an exception
to be thrown.
E. Calling setAttribute(“keyA”, “valueB”) on an HttpSession which already holds a value for the key keyA will cause the previous value for this attribute to be replaced with the String valueB


answer was given as A,CE .
can anyone explian me the meaning of ans C??
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attributes bound into a session are available to any other servlet that belongs to the same ServletContext and handles a request identified as being part of the same session.


session is meant for one per JVM, and servlet context also belongs to one per JVM. all the request which are asscociate by a particualr seesion (by belong to a particular client) can access the undelying sessin object and related attributes also.

session can be persist as long as a servlet contaxt.
 
sravanthi pulukuri
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks poonam!!!
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AnyTime Budy keep posting
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic