• Post Reply Bookmark Topic Watch Topic
  • New Topic

TLD for custom JSF UI component

 
Chandan Rajan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have implemented a custom JSF UI Component that extends HtmlGraphicImage. I have introduced a couple of new attributes for my tag by specifying them in the tld file. The new attributes work fine.

But I also want to expose the attributes of h:graphicImage (the component I am extending). To achieve this I have copy pasted graphicImage's attributes from graphicImage's tld file into my tld. Is there a better way to expose the attributes of the base component that I am extending on the tld?

TIA,
Chandan
 
Jason Lee
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chandan Rajan:

But I also want to expose the attributes of h:graphicImage (the component I am extending). To achieve this I have copy pasted graphicImage's attributes from graphicImage's tld file into my tld. Is there a better way to expose the attributes of the base component that I am extending on the tld?


I'm not sure how easy it would be to apply this technique to your project now, but you might find this useful either way:

http://java.sun.com/developer/technicalArticles/J2EE/jsf_templating/index.html

That's the approach Mojarra Scales uses, and I like quite a bit. I should, since I co-authored that article, right? :P By using annotations and apt at compile time, I have the TLD, JSP Tag, and Facelets taglib.xml generated for me. This article uses a JSFTemplating-based Renderer, but there's no need for you to do so if you don't want to (though I've found that template-based Renderers are often a lot easier to maintain, as I don't have a million writer.write*() calls).
[ April 29, 2008: Message edited by: Jason Lee ]
 
Chandan Rajan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jason. The approach is pretty interesting. Unfortunately, we are still in java 1.4. So it will be sometime before we move on to 1.5.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!