In my JSF application I have two <h:inputText> components. I need to make sure that value is entered in at least one of them. How can I implement such a validator?
I am aware that I can use JavaScript for this, but I’d prefer to do the checks in the server side.
Bind the components to the view, create a
<h:inputHidden value="true">which you put before the components wherein you attach the validator and pass the components as attributes.E.g.
with this
@FacesValidator("oneOrMoreValidator")implementation: