To create a custom component in JSF, it is necesary create a class that extends UIComponent and register its component type in JSF,using for example @FacesComponent. To use this component and its attributes in a facelets page, it is necesary link the component with the facelets tag in a special file called tag description file:
<tag> <tag-name>test</tag-name> <component> <component-type>local.test.component_type</component-type> </component> </tag> Ok, but I'm confused with the use of tag classes (and tag handlers). Looking at mojarra source code, all html basic components are declared in the tag library description file using a component tag class that extends UIComponentELTag. For example:
<tag> <name>commandButton</name> <tag-class> com.sun.faces.taglib.html_basic.CommandButtonTag </tag-class> </tag> Looking at JSF api of UIComponentELTag:
UIComponentELTag specializes its superclass to allow for properties that take their values from EL API expressions.
This tag is designed for use with Faces version 1.2 and JSP version 2.1 containers.
Then the question is, when I should use a class that extends a UIComponentELTag to link the tag attributes with the custom component instead of to link the component through ? If I don't use a tag class, then my comonent cannot be used in JSP pages or previous JSF versions and only will work in JSF facelets?