Registering the Component and the Renderer

The components and its renderer are registered like this in the faces-config.xml file:

<faces-config>
  ...
  <component>
    <component-type>
      com.mycompany.Tree
    </component-type>
    <component-class>
      com.mycompany.jsf.component.UITree
    </component-class>
  </component>
  ...
  <render-kit>
    <renderer>
      <component-family>com.mycompany.Tree</component-family>
      <renderer-type>com.mycompany.Tree</renderer-type>
      <renderer-class>
        com.mycompany.jsf.renderer.TreeRenderer
      </renderer-class>
    </renderer>
  </render-kit>
  ...
</faces-config>

This is the same kind of declarations as you’ve seen earlier, with a <component> element for mapping the component type identifier to the component implementation class and a <renderer> element for mapping the combination of a component family and a renderer type to the renderer implementation class.

Get JavaServer Faces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.