Richfaces - <rich:autocomplete>不显示建议</rich:autocomplete>

时间:2014-04-29 22:49:56

标签: jsf jsf-2 richfaces

我在自动填充方面遇到问题而没有显示建议。不知道我错过了什么。代码:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich">
  <h:head />
  <h:body>
    <h:form>
      <rich:autocomplete autocompleteMethod="#{myBean.autocomplete}" var="item">
    <h:outputText value="#{item}" />
      </rich:autocomplete>
    </h:form>
  </h:body>
</html>

@ManagedBean
@SessionScoped
public class MyBean {
    public List<String> autocomplete(FacesContext ctx, UIComponent c, String prefix) {
        return Arrays.asList(new String[] {"foo", "bar", "baz"});
    }
}

我键入时调用bean方法,我可以在浏览器控制台中看到AJAX POST返回结果:

<!-- ... snip ... -->
<componentData>{"j_idt5:j_idt6":["for","bar","baz"] }</componentData>

然而,建议不会显示。有什么想法吗?

使用部署在JBoss WildFly 8上的JSF 2和Richfaces 4.3.4。

1 个答案:

答案 0 :(得分:0)

原来这是一个已知问题(RF-13587)。它可以通过使用JSF版本2.1.25来解决,如下所述:

RichFaces 4 autocomplete is not showing suggestions