2. Using the Tutorial Examples
3. Getting Started with Web Applications
5. JavaServer Pages Technology
7. JavaServer Pages Standard Tag Library
10. JavaServer Faces Technology
11. Using JavaServer Faces Technology in JSP Pages
12. Developing with JavaServer Faces Technology
13. Creating Custom UI Components
Determining Whether You Need a Custom Component or Renderer
When to Use a Custom Component
Component, Renderer, and Tag Combinations
Understanding the Image Map Example
Why Use JavaServer Faces Technology to Implement an Image Map?
Understanding the Rendered HTML
Summary of the Application Classes
Creating Custom Component Classes
Specifying the Component Family
Enabling Component Properties to Accept Expressions
Delegating Rendering to a Renderer
Handling Events for Custom Components
Creating the Component Tag Handler
Setting Component Property Values
Setting the Component Property Values
Defining the Custom Component Tag in a Tag Library Descriptor
14. Configuring JavaServer Faces Applications
15. Internationalizing and Localizing Web Applications
16. Building Web Services with JAX-WS
17. Binding between XML Schema and Java Classes
19. SOAP with Attachments API for Java
21. Getting Started with Enterprise Beans
23. A Message-Driven Bean Example
24. Introduction to the Java Persistence API
25. Persistence in the Web Tier
26. Persistence in the EJB Tier
27. The Java Persistence Query Language
28. Introduction to Security in the Java EE Platform
29. Securing Java EE Applications
31. The Java Message Service API
32. Java EE Examples Using the JMS API
36. The Coffee Break Application
37. The Duke's Bank Application
You can apply the following steps while developing your own custom component.
Create a custom component class that does the following:
Overrides the getFamily method to return the component family, which is used to look up renderers that can render the component.
Includes the rendering code or delegates it to a renderer (explained in step 2).
Enables component attributes to accept expressions.
Queues an event on the component if the component generates events.
Saves and restores the component state.
Delegate rendering to a renderer if your component does not handle the rendering. To do this:
Create a custom renderer class by extending javax.faces.render.Renderer.
Register the renderer to a render kit.
Identify the renderer type in the component tag handler.
Register the component.
Create an event handler if your component generates events.
Write a tag handler class that extends javax.faces.webapp.UIComponentELTag. In this class, you need a getRendererType method, which returns the type of your custom renderer if you are using one (explained in step 2); a getComponentType method, which returns the type of the custom component; and a setProperties method, with which you set all the new attributes of your component.
Create a tag library descriptor (TLD) that defines the custom tag.
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. Using a Custom Component discusses how to use the custom component in a JavaServer Faces page.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices
Scripting on this page tracks web page traffic, but does not change the content in any way.