Previous Section  < Day Day Up >  Next Section

<converter>

The <converter> element declares the implementation class for a converter.

Syntax

<converter>

  [<description [xml:lang="lang"]>description</description>]*

  [<display-name [xml:lang="lang"]>displayName</display-name>]*

  [<icon [xml:lang="lang"]>

     [<small-icon>iconPath</small-icon>]

     [<large-icon>iconPath</large-icon>]

   </icon>]*

  <converter-id>converterId</converter-id> |

    <converter-for-class>targetClassName</converter-for-class>

  <converter-class>className</converter-class>

  [<attribute>

    [<description [xml:lang="lang"]>description</description>]*

    [<display-name [xml:lang="lang"]>displayName</display-name>]*

    [<icon [xml:lang="lang"]>

       [<small-icon>iconPath</small-icon>]

       [<large-icon>iconPath</large-icon>]

     </icon>]*

     <attribute-name>attrName</attribute-name>

     <attribute-class>className</attribute-class>

     [<default-value>defaultValue</default-value>]

     [<suggested-value>suggestedValue</suggested-value>]

     [<attribute-extension>extension</attribute-extension>]*

   </attribute>]*

  [<property>

    [<description [xml:lang="lang"]>description</description>]*

    [<display-name [xml:lang="lang"]>displayName</display-name>]*

    [<icon [xml:lang="lang"]>

       [<small-icon>iconPath</small-icon>]

       [<large-icon>iconPath</large-icon>]

     </icon>]*

     <property-name>propName</property-name>

     <property-class>className</property-class>

     [<default-value>defaultValue</default-value>]

     [<suggested-value>suggestedValue</suggested-value>]

     [<property-extension>extension</property-extension>]*

   </property>]*

</converter>

The <converter-class> element contains the fully qualified class name that implements the javax.faces.convert.Converter interface. If the converter should be accessible through an identifier, it's declared by the <converter-id> element. For a converter used for conversion of a particular data type, the <converter-for-class> element declares the fully qualified class name for the target data type These are the only mandatory elements:

<converter>

  <converter-id>com.mycompany.MyConverter</converter-id>

  <converter-class>

    com.mycompany.jsf.MyConverter

  </converter-class>

</converter>

<converter>

  <converter-for-class>java.util.Locale</converter-for-class>

  <converter-class>

    com.mycompany.jsf.MyLocaleConverter

  </converter-class>

</converter>

The <attribute> and <property> elements provide information about the component's generic attributes and type-safe converter properties, respectively, that may be used by a development tool to help a developer use the converter, the same way for the <component> element.

    Previous Section  < Day Day Up >  Next Section