After creating custom converter class implementing Converter
interface it needs to register in the faces context. This can be done in
one of the two ways :
- Register the converter class with the id. This id is used in
<f:convertrer> tag in our view page (For example, JSP).
<converter>
<converter-id>ms_Converter</converter-id>
<converter-class>ms_Converter</converter-class>
</converter> |
Use this converter in the view page as :
<h:inputText id="input_text"> <f:converter converterId="ms_Converter" />
</h:inputText> |
- Register the converter class to handle all "Email" objects,
for example, automatically.
<converter> <converter-for-class>Email</converter-for-class> <converter-class>EmailConverter</converter-class>
</converter> |
If we register the EmailConverter class to handle all Email objects automatically then
there is no need to use the <f:converter/> tag in view page. Use
this converter as :
<h:inputText id="phone" value="#{Bean.email}">
</h:inputText> |
|
|