• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to Write Such a Custom Tag

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to use SimpleTagSupport to write a custom tag which is like this:

<my:Menu>
<my:MenuItem ../>
<my:MenuItem ../>
text here should not be rendered
<my:Menu>

In body of <my:Menu>, the only content should be nested tag defining the items to be included in this menu. Any text that caller put inside the body of the <my:Menu> should be ignored.

In the doTag() of my SimpleTagSupport, if I do not include "getJspBody().invoke(null)", the body is not evaluated and the child tag handler for <my:MenuItem ../> will not be invoked. But, if I do include "getJspBody().invoke(null)", the text along side the <my:MenuItem ../> would be displayed!! So how should I write my doTag()??
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try in tld specify <bodycontent>JSP</bodycontent>
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic