PrimeFaces 组件不显示,而标准 JSF 组件呈现良好 [英] PrimeFaces components don't display while standard JSF components render fine
问题描述
Java EE6/CDI JSF2 Primefaces 3.3.1.我创建了一个带有几个级联下拉列表的搜索页面,用于生成搜索结果表 如果我使用 jsf:
Java EE6/CDI JSF2 Primefaces 3.3.1. I created a search page with a few cascading dropdowns that are used to generate a table of search results If I use jsf:
<h:dataTable var="_employeeVList" value="#{employeeVProducer.employeeVList}" rendered="#{not empty employeeVProducer.employeeVList}">
<f:facet name="header">
Employee Search Results
</f:facet>
<h:column>
<f:facet name="header">Area</f:facet>
<h:outputText value="#{_employeeVList.areaName}" />
</h:column>
...
</h:dataTable>
表格呈现输出,html看起来正常.但是当我换成素面时:
The table renders with output, html looks normal. But when I change to primefaces:
<p:dataTable var="_employeeVList" value="#{employeeVProducer.employeeVList}" rendered="#{not empty employeeVProducer.employeeVList}">
<f:facet name="header">
Employee Search Results
</f:facet>
<p:column>
<f:facet name="header">Area</f:facet>
<h:outputText value="#{_employeeVList.areaName}" />
</p:column>
...
</p:dataTable>
表格不显示.当我用 firebug 查看源代码时,我发现 html 有点奇怪:
The table doesn't display. When I look at the source with firebug I see some weirdness with the html:
<table id="searchForm:results">
<tbody>
<tr>
<td>
<p:datatable rendered="true" value="[com.raytheon.myPkg.EmployeeV@f486, com.raytheon.myPkg.EmployeeV@88fe, com.raytheon.myPkg.EmployeeV@adaf,
...
com.raytheon.myPkg.EmployeeV@6a5b]"
var="_employeeVList">
<p:column></p:column>
<p:column></p:column>
...
</p:datatable></td>
</tr>
</tbody>
</table>
对象在标签标签中,列是空的.在页面的其他地方,我正在使用 p:panelGrid,它包含下拉列表并且显示正确.
The objects are in the tag label, the columns are empty. Elsewhere in the page I'm using p:panelGrid, that contains the dropdowns and that displays correctly.
我的默认模板页面中有 h:head 和 h:body.
I have h:head and h:body in my default template page.
该表由有状态请求范围的 bean 支持.
The table is backed by a stateful request scoped bean.
我没有使用任何外部 JavaScript.
I'm not using any external JavaScript.
我做错了什么?
推荐答案
因此,
标签根本没有被解析为 JSF 标签,并且在生成的HTML 输出.这可能有以下一个或多个原因:
Thus, the <p:xxx>
tags are not been parsed as JSF tags at all and appear plain vanilla in the generated HTML output. That can have one or more of the following reasons:
您忘记在视图中声明
p:
XML 命名空间,或者您使用了错误的命名空间 URI.应该是:
You forgot to declare the
p:
XML namespace in the view, or you used the wrong namespace URI. It should be:
xmlns:p="http://primefaces.org/ui"
您忘记实际安装 PrimeFaces 库.这应该是一个问题
You forgot to actually install the PrimeFaces library. It should be a matter of either
一个.将 primefaces.jar
放到 webapp 的 /WEB-INF/lib
文件夹中.
a. Dropping primefaces.jar
in webapp's /WEB-INF/lib
folder.
B.确保您的依赖项管理器(例如 Maven)已配置为将 PrimeFaces 添加到项目并将其添加到运行时 /WEB-INF/lib
文件夹
b. Making sure your dependency manager (e.g. Maven) has been configured to add PrimeFaces to the project and added it to the runtime /WEB-INF/lib
folder
这篇关于PrimeFaces 组件不显示,而标准 JSF 组件呈现良好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!