O'Reilly logo

JavaServer Faces by Hans Bergsten

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Registering the Component

All custom components must be registered in the faces-config.xml file. Here’s how you register the UITabLabel component:

<faces-config>
  ...
  <component>
    <component-type>
      com.mycompany.TabLabel
    </component-type>
    <component-class>
      com.mycompany.jsf.component.UITabLabel
    </component-class>
  </component>
  ...
</faces-config>

The <component> element contains two mandatory nested elements. The <component-type> element assigns the component a unique identifier and the <component-class> holds the fully qualified component class name. As you may recall from Chapter 6, the code that creates components does so by calling the Application createComponent() method. It takes the component type identifier as the argument and returns an instance of the class mapped to the identifier.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required