f:converter |
|
The Converter tag registers a Converter instance on the component associated with the enclosing tag. It takes one attribute: the converterId that you used to register your converter in your Faces configuration file.
The Converter interface is implemented by classes that handle custom conversion of user input into a data type expected by the domain model of your JSF application, and vice versa. For example, you might have a select list of countries that your user can choose from.
Example
<h:selectOneMenu value="#{customerBean.customer.address.country}">
<f:converter converterId="countryConverter"></f:converter>
<f:selectItems value="#{locationBean.countryList}"></f:selectItems>
</h:selectOneMenu>
HTML Output
<select>
<option value="1">Canada</option>
<option value="2">USA</option>
...
</select>
|