Wednesday, April 23, 2014

JSF - Custom Converter

  • Defining a custom converter in JSF is a three step process
1    Create a converter class by implementing javax.faces.convert.Converter interface.
2    Implement getAsObject() and getAsString() methods of above interface.
3    Use Annotation @FacesConvertor to assign a unique id to the custom convertor.
http://www.tutorialspoint.com/jsf/jsf_customconvertor_tag.htm

  • Steps
1. Create a converter class by implementing javax.faces.convert.Converter interface.
2. Override both getAsObject() and getAsString() methods.
3. Assign an unique converter ID with @FacesConverter annotation.
4. Link your custom converter class to JSF component via f:converter tag.
http://www.mkyong.com/jsf2/custom-converter-in-jsf-2-0/

No comments:

Post a Comment