I have just started looking at JSF/JSP etc and am not sure if I am going down the right track with regards to extending the core JSF components.
This is what I have done:
1) I have extended javax.faces.component.html.HtmlCommandButton 2) I have extended com.sun.faces.taglib.html_basic.CommandButtonTag 3) I have registered my extended HtmlCommandButton in faces-config.xml 4) I have created a .tld file which has a tag pointing to my extended CommandButtonTag.
The problem I have is that when i import my taglib into a jsp I dont get any attributes?
Eg if I add an attribute "myAttribute" to my taglib I can reference it from my jsp. However, as my taglib points to my implementation of com.sun.faces.taglib.html_basic.CommandButtonTag I was expecting to be able to get all the attributes associated with it in my jsp.
Therefore I was expecting to be able to do something like:
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jul 26, 2007
When I put value in my .tld file I see the "value" attribute in the JSP.
My question was more should I need to add value to the .tld file as the tag in my tld file points to my tag class which is an extension of com.sun.faces.taglib.html_basic.CommandButtonTag which has "value" already?
TLD's don't inherit. If you're subclassing an existing custom tag, your new tag's TLD must define all properties you want that tag to support, not just ones that are unique to the subclass.
Joined: Jul 26, 2007
Thanks for confirming this.
So basically if I extend HTMLCommandButton/Tag and want to use all of its attributes as well as a new one defined in my implementation, I would have to redefine all the ones I wanted to use! Sounds like a bit of a nightmare...
If all the attributes have to be redefined then what is the purpose of extending an existing JSF component to create a custom JSF component.
I have started working on creating custom jsf components,I am extending UIInput text and it is a really a surprise for me to find that
all the attributes have to be redefined on custom component.