Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

Steps for Creating a Custom Component

Before we describe how the image map works, it helps to summarize the basic steps for creating an application that uses custom components. You can apply the following steps while developing your own custom component.

  1. Write a tag handler class that extends javax.faces.webapp.UIComponentTag. In this class, you need a getRendererType method, which returns the type of your custom renderer if you are using one (explained in step 4); a getComponentType method, which returns the type of the custom component; and a setProperties method, in which you set all the new attributes of your component
  2. Create a tag library descriptor (TLD) that defines the custom tag.
  3. Create a custom component class
  4. Include the rendering code in the component class or delegate it to a renderer (explained in step 7).
  5. If your component generates events, queue the event on the component.
  6. Save and restore the component state.
  7. Delegate rendering to a renderer if your component does not handle the rendering.
    1. Create a custom renderer class by extending javax.faces.render.Renderer.
    2. Register the renderer to a render kit.
    3. Identify the renderer type in the component tag handler.
  8. Register the component
  9. Create an event handler if your component generates events.
  10. Declare your new TLD.

The application architect does the work of registering the custom component and the renderer. See Registering a Custom Converter and Registering a Custom Renderer with a Render Kit for more information.

Divider
Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.