It is about validation in JSF. I know that there are two way for validation
- Bean Validation
- JSF Validation
I want to write my own validation class. Is it possible to add the custom validation class to JSF beans?
I don’t want to have the validation class in my facelett. Only in Bean…
Yes you can write your own validator class like this:
and use it in your facelets:
Note that the content of the
@FacesValidatorannotation must match thevalidatorIdattribute off:validator.Furthermore jsf input elements have an
validatorattribute. You can use this attribute to delegate validation to a special method in you backing bean.with