remember to throw ValidatorException instead of
else the message component might be not able to display the correct validation message.
public void validAbc(FacesContext context, UIComponent component, Object value) {
// some validation logic
if(value.equals("abc")) {
// proceed
} else {
throw new ValidatorException(new FacesMessage(
FacesMessage.SEVERITY.ERROR, null, "validation error message"));
}
}
Done!!
No comments:
Post a Comment