Month: August 2013

Validator method not checking empty field

Recently, I found out something very important about JSF validation: did you know that if you implement and associate a validation method, instead of a validation class and the component to be validated is empty, the validation code is not invoked? Well, according to BalusC in this post in stackoverflow, this is a known issue in JSF and, at the moment, it can be fixed only through the implementation of a validation class instead of a validation method (take a look at this recipe if you need to implement a validation class that uses some information from the backing bean). Hopefully, however, in the future, a new version of JSF implementation will take into account the new JSF 2.0 parameter “javax.faces.VALIDATE_EMPTY_FIELDS” and this workaround will no longer be necessary.