background image

Registering a Custom Converter

<< Registering a Custom Validator | Common Outcome Strings >>
<< Registering a Custom Validator | Common Outcome Strings >>

Registering a Custom Converter

Registering a Custom Converter
As is the case with a custom validator, if the application developer creates a custom converter,
you must register it with the application. Here is the converter configuration for
CreditCardConverter
from the Duke's Bookstore application:
<converter>
<description>
Converter for credit card
numbers that normalizes
the input to a standard format
</description>
<converter-id>CreditCardConverter</converter-id>
<converter-class>
com.sun.bookstore6.converters.CreditCardConverter
</converter-class>
</converter>
The converter element represents a Converter implementation and contains required
converter-id
and converter-class elements.
The converter-id element identifies an ID that is used by the converter attribute of a UI
component tag to apply the converter to the component's data.
"Using a Custom Converter" on
page 374
includes an example of referencing the custom converter from a component tag.
The converter-class element identifies the Converter implementation.
"Creating a Custom Converter" on page 393
explains how to create a custom converter.
Configuring Navigation Rules
As explained in
"Navigation Model" on page 307
, navigation is a set of rules for choosing the
next page to be displayed after a button or hyperlink component is clicked. Navigation rules are
defined in the application configuration resource file.
Each navigation rule specifies how to navigate from one page to a set of other pages. The
JavaServer Faces implementation chooses the proper navigation rule according to which page is
currently displayed.
After the proper navigation rule is selected, the choice of which page to access next from the
current page depends on two factors:
The action method that was invoked when the component was clicked
The logical outcome that is referenced by the component's tag or was returned from the
action method
Configuring Navigation Rules
Chapter 14 · Configuring JavaServer Faces Applications
451