You might want to do something like this and specify your own validator that later sets the Style
<h:inputText value="#{payment.card}" styleClass="#{payment.currentStyle}"
required="true" validator="#{payment.luhnCheck}"/>
Basically luhnCheck gets called, if valid nothing happens and card gets stored. Otherwise the currentStyle returns a
string with the name of the style to use in error cells (or input fields)