try
{
ExpressionFactory expFactory = facesContext.getApplication().getExpressionFactory();
// Use coersion implemented by JSP EL for consistency with EL
// expressions. Additionally, it caches some of the coersions.
return expFactory.coerceToType(value, desiredClass);
}
catch (ELException e)
{
String message = "Cannot coerce " + value.getClass().getName()
+ " to " + desiredClass.getName();