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 final mock exam ques - 55

 
Shruthi Karthick
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone explain me how the answer is BBUBUB?
If attribute key is already present in the session and if we call setAttribute on the same "key" is that equivalent to " removeAttribute(oldvalue) + setAttribute(new value)?
Pls clarify me..
 
Nitin Vashishtha
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Shruthi Karthick:

If attribute key is already present in the session and if we call setAttribute on the same "key" is that equivalent to " removeAttribute(oldvalue) + setAttribute(new value)?


Yes,if you set an attribute and one attribute already exists with that name, the new value will replace the old value for that attribute.
 
Shruthi Karthick
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you explain how the answer is BBUBUB
 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just gave mock exam, I too have same doubt, somebody please clarify
 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the code :

In servlet...



X is a listener implementing HttpSessionBindingListener

in valueBound method it prints B
in valueUnbound method it prints UB
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I remember some ranchers saying that they had different results depending on whether they use Websphere or Tomcat (here)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic