How to find the JSF component family component and visualizer

How can I find out the composite family and (by default) the visualizer type of the JSF component?

This data is needed when (overriding custom visualizers) using the following annotation:

@FacesRenderer(componentFamily="",rendererType="") 

I Googled, went according to the JSF specification and the book Ed Burn, but could not find what he wanted.

+4
source share
1 answer

Programmatically, you can find them simply by printing UIComponent#getFamily() and UIComponent#getRendererType() .

A documentary, you can find them just by looking in the component implementation javadoc. For example, <h:inputText> is represented by the HtmlInputText class. The type of visualizer can be found in the last paragraph of the javadoc introductory text:

By default, the rendererType property should be set to " javax.faces.Text ".

The component family can be found by checking the COMPONENT_FAMILY value of the constant value (which inherits from UIInput ). Go through the fields inherited from the javax.faces.component.UIInput class - COMPONENT_FAMILY - Constant field values

COMPONENT_FAMILY " javax.faces.Input "


Unrelated to a specific problem: you cannot override the default JSF rendering using the @FacesRenderer annotation. The default renderer would always get predefined. This is by design, see also issue 1748 . You really need to register them explicitly as <renderer> in the faces-config.xml the JSF 1.x path.

 <render-kit> <renderer> <component-family>javax.faces.Input</component-family> <renderer-type>javax.faces.Text</renderer-type> <renderer-class>com.example.CustomTextRenderer</renderer-class> </renderer> </render-kit> 
+11
source

All Articles