• Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing My Tag Handler by SimpleTagSupport  RSS feed

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When writing our own tag handler thru subclassing SimpleTagSupport I know I would process the tag body thru getJspBody().invoke(..). But, it seems that I can only display the content thru invoke(null) or send it to my own Writer object. What about if the body isnt to be simply displayed but rather containing something to be interpreted by my tag. A simple example would be a tag doing <c:catch> logic. How do I invoke the things inside my body and catch any exceptions thrown?
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you probably don't want to get into the realms of parsing the tag content, simply just execute the body by calling the invoke(null) method.

You can always set attributes in the tag and access them within the body tag - this is quite useful for looping in a similar way to c:forEach tags, for example (some paging function I wrote in the past)




If you need additional checks like catch blocks, use them to wrap around your custom tag or wrap riskly operation within the body.
[ September 07, 2005: Message edited by: Daniel Rhoades ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!