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 Custom Tag

 
Ramprasad Subburaman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
During development of classic custom tag, I had few clarifications.

1) Can we access the Body of the Custom Tag, in the Tag Handler??

Eg:


2) If YES, how would you modify the same??

3) Is there doAfterTag() method??? (noticed in notes provided by Frederic Esnault Pg no 40 (http://esnault.frederic.free.fr/certification/scwcd_notes.pdf)

4) If doAfterTag() exist when it is called??

Thanks in advance.

Regards,
Ramprasad
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically you need to implement your tag as a BodyTag (rather than just a Tag or IterationTag). Then everything becomes easy...

By implementing BodyTag, you'll get access to a BodyContent object which represents the state of the body content just evaluated by the container. By the time doAfterBody() is invoked, the BodyContent for that BodyTag handler instance will have been filled with the evaluated contents from the (just performed) previous iteration. Then you can access the data contained in the BodyContent instance, modify/delete the data and then choose whether or not to write the data to the output stream.

Check the J2EE API documentation for BodyTag and BodyContent classes for more information.
 
Ramprasad Subburaman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Charles Lynos.

Your information was helpful in debugging my code.

Observation: For classic tag which extends BodyTagSupport, we need to explicitly write the bodyContent.


Above case is not for class which extends from TagSupport.

Offcourse, I kindly request someone to confirm the same.

Thanks & Regards
Ramprasad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic