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

Classic Tag Handler Question

 
Cindy Carney
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there. I'm studying for the SCWCD, and have encountered a mystery I hope someone out there can clear up.

The TagSupport object has two methods, 'getValue' and 'setValue', that are poorly documented. WHERE does it store the value to, and get it from? Are these local to the tag only, or are they setting it in the request or page scope attributes?
 
Keith Flo
Ranch Hand
Posts: 128
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cindy,

getValue() and setValue() in TagSupport (and the other related methods like getValues() and removeValue() ) implement methods from the Tag interface.

To answer your question more directly .. my understanding is .. the container calls these methods as part of the initialization process for a classic tag.

The API says : "The Tag interface specifies the setter and getter methods for the core pageContext and parent properties. The JSP page implementation object invokes setPageContext and setParent, in that order, before invoking doStartTag() or doEndTag(). " The 'JSP implementation object' is the container.

 
Keith Flo
Ranch Hand
Posts: 128
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course you can write your own implementation of the Tag Interface ...

I took a quick look at the spec (p. 302) and it mentions defining properties in a classic tag as javabeans ... getValue() and setValue() would be useful in that situation too ... but I dont think I'll be writing any classic tags if I can possibly avoid doing so ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic