wood burning stoves 2.0*
The moose likes JSF and the fly likes TLD for custom JSF UI component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "TLD for custom JSF UI component" Watch "TLD for custom JSF UI component" New topic
Author

TLD for custom JSF UI component

Chandan Rajan
Greenhorn

Joined: Apr 25, 2008
Posts: 10
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

Joined: Mar 03, 2008
Posts: 12
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 ]

Jason Lee, SCJP
Senior Member of Technical Staff with Oracle
http://blogs.steeplesoft.com
Chandan Rajan
Greenhorn

Joined: Apr 25, 2008
Posts: 10
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.
 
 
subject: TLD for custom JSF UI component
 
Similar Threads
Extending JSF Components
Doubts in Dynamic Attributes
Custom Component with dynamic components.
Extending tags etc
Add a custom attribute