Input text validation based on drop-down list selection
问题 How can I validate an input text box based on a selection from the drop-down list? 回答1: You could pass the selected value of the dropdown as an attribute of the input component so that the validator can grab it. E.g. <h:selectOneMenu binding="#{menu}" value="#{bean.item}"> <f:selectItems value="#{bean.items}" /> </h:selectOneMenu> <h:inputText value="#{bean.input}"> <f:attribute name="item" value="#{menu.value}" /> <f:validator validatorId="inputValidator" /> </h:inputText> with