How to findout component-family and renderer-type of a JSF component

ぃ、小莉子 提交于 2019-12-01 07:03:08

Programmatically, you could find them out by just printing UIComponent#getFamily() and UIComponent#getRendererType().

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

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

The component family can be found by checking the value of COMPONENT_FAMILY constant field value (which is inherited from UIInput). Click your way through the Fields inherited from class javax.faces.component.UIInput - COMPONENT_FAMILY - Constant Field Values

COMPONENT_FAMILY "javax.faces.Input"


Unrelated to the concrete problem: you cannot override the default JSF renderers by the @FacesRenderer annotation. The default renderer would always get prededence. 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 way.

<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>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!