【问题标题】:primefaces autocomplete doens't work, strange errorprimefaces 自动完成不起作用,奇怪的错误
【发布时间】:2013-12-31 06:43:02
【问题描述】:

我正在尝试从 primefaces 使用,但我遇到了一些奇怪(和“不可见”)的问题。 我正在使用 Spring/Hibernate/Primefaces 这是我的 .xhtml 代码:

   <p:autoComplete cache='true' id='autocomplete'
                        value="#{controller.filter_field_editor}"
                        completeMethod="#{controller.getAll()}"
                        dropdown="true" />

'getAll' 函数的代码是这样的:

public List<String> getAll(){
    List<HardTag> allhardtags = new  ArrayList<HardTag>();
    List<String> allhardtags_titles = new ArrayList<String>();
    allhardtags = repositoryService.findByCollection("Editors");
    for (HardTag hardTag : allhardtags) {
        allhardtags_titles.add(hardTag.getTitle());
    }

    return allhardtags_titles;

}

如果我调试,当我返回 allhardtags_titles 时,这个变量有一个正确的字符串列表,但自动完成输入不显示任何内容。

我的控制台也没有显示任何内容,所以我意识到我有 Web 开发人员工具...但是所有检查(标准/CSS/Jscript)都正常,即使我点击 Jscript,这里也有一个错误。

> Fecha y hora: 12/12/2013 18:38:57
Error: no se encuentra elemento (*can't find element)
Archivo de origen: http://localhost:8080/inbox.xhtml
Línea: 1

如果我点击它,它会显示:

<!DOCTYPE html >

仅此而已……所以我有点迷路了!

如果需要更多,请告诉我!提前致谢!

有人有想法吗?

【问题讨论】:

  • 当它应该有一个String参数时,为什么你在后端使用一个非参数方法?
  • 嗯,不需要。我按照示例进行,不需要发送参数。

标签: jquery jsf jsf-2 primefaces autocomplete


【解决方案1】:

问题解决了。

替换这个:

 <ui:include src="${pageContext.request.contextPath}/things/video/components/header.xhtml" />

对于这个:

 <ui:include src="components/header.xhtml" />

它有效...我不明白为什么...可能是 '${pageContext.request.contextPath}' 的某种问题...

感谢您的帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-29
    • 1970-01-01
    • 1970-01-01
    • 2023-04-09
    • 1970-01-01
    • 2012-05-18
    • 2021-11-07
    • 1970-01-01
    相关资源
    最近更新 更多