• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Writing My Tag Handler by SimpleTagSupport

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic