如何使用表格布局自动完成richfaces?

时间:2011-03-17 05:06:17

标签: java eclipse jsf jboss richfaces

我正在使用rich:autocomplete进行用户搜索。

搜索结果包含用户的所有详细信息,例如姓名,地址,年龄和年龄。照片。

这是我的代码:

<rich:autocomplete mode="client" showButton="true" 
        layout="table" autocompleteMethod="#{patientSearch.autocomplete}" 
        fetchValue="#{patient.patientId}" id="txtPatientSearch" var="patient">
    <rich:column>
        <h:graphicImage value="/resources/images/default.png" />
    </rich:column>
    <rich:column>
        <h:outputText value="#{patient.fname}" />
    </rich:column>
    <rich:column>
        <h:outputText value="#{patient.lname}" />
    </rich:column>
    <rich:column>
        <h:outputText value="#{patient.gender}" />
    </rich:column>
    <rich:column>
        <h:outputText value="#{patient.mrn}" />
    </rich:column>
</rich:autocomplete>

和bean的自动完成方法:

public List<SearchPatient> autocomplete(String search) {
    ArrayList<SearchPatient> result = new ArrayList<SearchPatient>();
    Iterator<SearchPatient> iterator 
        = patientDAO.searchPatientByAll(search, 1, this.sessionToken).iterator();
    while (iterator.hasNext()) {
        SearchPatient elem = ((SearchPatient) iterator.next());
        result.add(elem);
    }
    return result;
}

但是当我部署我的应用程序时,它会例外:

  

javax.el.PropertyNotFoundException:在类型xtremum.health.web.bean.PatientSearchBean上找不到属性'autocomplete'

这个bean包含自动完成方法。如何对表结构使用自动完成?

1 个答案:

答案 0 :(得分:1)

您好我的问题已解决我在代码中进行更改并且更改

  1. 从客户端更改模式到ajax,
  2. autocompleteMethod&amp; autocompleteList都添加在标记
  3. 这是XHTML

    <rich:autocomplete mode="ajax" showButton="true"
        layout="table" autocompleteMethod="#{patientSearch.searchPatientByAll}"
        autocompleteList="#{patientSearch.searchPatient}"
        fetchValue="#{patient.patientId}" id="txtPatientSearch" var="patient">
      <rich:column>
        <h:graphicImage value="/resources/images/default.png" />
      </rich:column>
      <rich:column>
        <h:outputText value="#{patient.fname}" />
      </rich:column>
      <rich:column>
        <h:outputText value="#{patient.lname}" />
      </rich:column>
      <rich:column>
        <h:outputText value="#{patient.gender}" />
      </rich:column>
      <rich:column>
        <h:outputText value="#{patient.mrn}" />
      </rich:column>
    </rich:autocomplete>
    

    bean方法看起来像

    private @Getter @Setter List<SearchPatient> searchPatient;
    public List<SearchPatient> searchPatientByAll(String search) {
      this.searchPatient=patientDAO.searchPatientByAll(search, 1, this.sessionToken);
      return this.searchPatient;
    }