组件按其在组件树中出现的顺序进行处理。所以如果
otherControlInput
出现
组件树中当前已验证的组件,则尚未对其进行处理。然后需要访问它的(未转换和未验证!)价值依据
UIInput#getSubmittedValue()
而不是
UIInput#getValue()
.
Object otherControlValue = otherControlInput.getSubmittedValue();
UIInput#getValue()
.
required
属性相互依赖:
<h:inputText binding="#{from}" value="#{bean.from}" required="#{not empty to.submittedValue}" />
<h:inputText binding="#{to}" value="#{bean.to}" required="#{not empty from.value}" />