1

我正在尝试根据另一个字段的值来验证一个字段。

<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 日历组件的文本框中出现的值在哪里?

4

2 回答 2

2

尝试这个:item:startDatInputDate

于 2010-05-14T07:07:47.867 回答
0

请检查您在此处标记中使用的bean中的startDate值。

于 2009-09-17T09:26:21.687 回答