First, when a error ocurrs when the component are validanting or converting the request value in the phase of Process Validations the jsf-impl throws a ConverterException or ValidatorException that excepction is catch in the component that add a FacesMessage with the severity set a FacesMessage.SEVERITY_ERROR, for that you can't use the severity property to identify the cause of the FacesMessage as suggested by Victor Hugo.
All Standar Validation message errors start with Validation Error this can serve to help identify a FacesMessage for a validation error
Since JSF 1.2 you can use in the components that implements the EditableValueHolder interface as h:inputText the converterMessage and validatorMessage this you can use to show a message when a conversion or validation ocurrs.
When a dream is ending because to come true - OCPJP 6,7. OCE JPA EE6. MCTS
Joined: Jun 18, 2010
My problem is how can i know if a FacesMessage is a ValidationException in the BackingBean. Because we start the exception passing as parameter the FacesMessage, and that one is added in the FacesContext. Seeing each FacesMessage one by one i need to know if it is a message that is originally a ValidationException.
Ok, wandroide I think I understand you, but here you have a problem the FacesMessage is designed to be a general class, since any developer can use this class to show any message (regardless of whether validation error messages or conversion) in the redered page whith the help of <h:message> or <h:messages>, and for that reason FacesMessage don't have properties to indicate the reason of the message.
As I was saying in the previous post the most standar validation message errors contians the word Validation Error, except for RegexValidator that contains Regex Patter or BeanValidator, you can use this to identify if the message was produced for a ValidatorException.