JSF converter Tag

This tag is used to register the converter instance on the enclosing component. Many times it is required to convert the input to the appropriate type. In this case this tag can be useful. It takes one required attribute "converterId". In this attribute we specify the name of backing bean class which implements Converter interface. You have to maintain the faces-config file where converter-id and converter-class is specified within the converter element.

Code Description :

<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>






















Rendered Output : This is the first output that comes in front of the user.

When user inputs wrong input that can not be converted to the appropriate type then the conversion error occurs, like below :

Html Source Code :
















This tag contains one attribute :

converterId : This is the required attribute and is used to specify the ID of the converter class which is used in the conversion process (in the case of custom conversion).

0 comments:

Post a Comment