我正在尝试根据另一个字段的值来验证一个字段。
<h:form id="item">
<s:validateAll/>
<h:selectBooleanCheckbox id="selected" value="#{bean.selected}" validator="selectedValidator"/>
<rich:calendar id="startDate" value="#{bean.startDate}"/>
</h:form>
但是,在我的验证器内部。
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
UIInput startComp = (UIInput) context.getViewRoot().findComponent("item:startDate");
if(value != null && value) {
// Check value of startComp and throw exception if null or empty.
}
}
组件 startComp 解析,但没有任何价值。Richfaces 日历组件的文本框中出现的值在哪里?