I create a custom component for SelectOneRadio, and I register it in xyz.taglib.xml and so far it works. The only problem is that my NetBeans cannot see my tag attribute in auto-complete. For example, if I have layout="pageDirection" in my custom component, then it render correctly, but when I (Ctrl + space) I do not see layout, value … attributes. Here is how I register my custom component in my WEB-INF/faces-config.xml, I have
<component>
<component-type>com.xyz.om.ui.component.SelectOneRadio</component-type>
<component-class>
com.xyz.om.ui.component.SelectOneRadio
</component-class>
<component-extension>
<component-family>com.xyz.om.ui.component.SelectOneRadio</component-family>
<renderer-type>com.xyz.om.ui.renderer.SelectOneRadioRenderer</renderer-type>
</component-extension>
</component>
<render-kit>
<renderer>
<component-family>com.xyz.om.ui.component.SelectOneRadio</component-family>
<renderer-type>com.xyz.om.ui.renderer.SelectOneRadioRenderer</renderer-type>
<renderer-class>
com.xyz.om.ui.renderer.SelectOneRadioRenderer
</renderer-class>
</renderer>
</render-kit>
In my WEB-INF/xyz.taglib.xml, I have
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://example.com/ui</namespace>
<tag>
<tag-name>selectOneRadio</tag-name>
<component>
<component-type>com.xyz.om.ui.component.SelectOneRadio</component-type>
<renderer-type>com.xyz.om.ui.renderer.SelectOneRadioRenderer</renderer-type>
</component>
</tag>
</facelet-taglib>
so I register the xyz.taglib.xml in web.xml as follow
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/xyz.taglib.xml</param-value>
</context-param>
After this steps, if I Ctrl + space (Netbeans) on the custom component, I can only see class, id, parent , rendered, rendererType, transient. So I try create a xyz.tld under WEB-INF, like this
<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
<tlib-version>1.0</tlib-version>
<short-name>xyz</short-name>
<uri>http://example.com/ui</uri>
<tag>
<name>selectOneRadio</name>
<tag-class>com.xyz.om.ui.tag.SelectOneRadioTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
xyz description
</description>
<name>name</name>
<required>false</required>
<deferred-value>
<type>java.lang.String</type>
</deferred-value>
</attribute>
</tag>
</taglib>
but still the name attribute does not show in netbeans when I write out the tag. I guess my question is how to get netbeans to auto-complete my custom component’s attributes, because everything works, but no auto-complete is a pain
The attributes are autocompleted based on the
.taglib.xmlfile. You need to register every individual attribute in the<tag>element.The
.tldis only mandatory when you plan to support JSP next to Facelets as well. Note that JSF 2.0 itself doesn’t support JSP, it’ll run in JSF 1.2 fallback modus.