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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s