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 (page 384) includes an example of referencing the custom converter from a component tag.

The converter-class element identifies the Converter implementation.

Creating a Custom Converter (page 405) explains how to create a custom converter.



The JavaT EE 5 Tutorial
The JavaT EE 5 Tutorial
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 309

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net