This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getValue() method

 
dolly shah
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This is from HFSJ book. Chapter no:5,page:218. They have written that "the getValue() method returns the OLD value of the attribute if the attribute was replaced." But here old value is "b" for "a". So why it is returning "c"?"c" is the new value. Anybody can explain?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API for ServletRequestAttributeEvent#getValue is clear about that :
Returns the value of the attribute that has been added, removed or replaced. If the attribute was added (or bound), this is the value of the attribute. If the attribute was removed (or unbound), this is the value of the removed attribute. If the attribute was replaced, this is the old value of the attribute.

They have written that "the getValue() method returns the OLD value of the attribute if the attribute was replaced

What did you get after : "P:" ? (which is your replace method)

You should have :
A:a->b (set a to b)
P:a->b (replace a by c, so the old value b is printed)
M:a->c (remove a)
 
dolly shah
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I got it now. Sorry for late reply. But I had not been reading from a couple of days & from today I have started again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic