I'm doing some testing on MyFaces to make sure all is behaving as
described in the spec for some of the new tags. I've run into an issue
where I need some clarification on the spec though regarding the
validateRequired tag.
The confusion lies in what the interaction and precedence should be for
the validateRequired tag vs. the javax.faces.VALIDATE_EMPTY_FIELDS param
setting and the algorithm specified for UIInput.validateValue().
The validateValue algorithm says that if
javax.faces.VALIDATE_EMPTY_FIELDS has not been set, that we only execute
the validators if bean validation is present. This, however, will
prevent the RequiredValidator from executing as well. Since the javadoc
states that adding an f::validateRequired tag has the same affect as
setting required="true" on the UIInput, it would seem that at least for
this validator, we need to validate empty fields even if bean validation
is not present.
What is the proper behavior here? Should we be ignoring the
validateRequired tag unless bean validation is present? Should we be
executing only the RequiredValidator if one is attached? all validators
if a RequiredValidator is attached? What about if VALIDATE_EMPTY_FIELDS
is explicitly set to false?
Any clarification on this would be much appreciated.
Thanks,
Mike