PrimeFaces组件不显示,而标准JSF组件可以正常显示 [英] PrimeFaces components don't display while standard JSF components render fine

查看:68
本文介绍了PrimeFaces组件不显示,而标准JSF组件可以正常显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

我在做什么错了?

推荐答案

因此,<p:xxx>标记根本没有被解析为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:

  1. 您忘记在视图中声明p: XML名称空间,或者您使用了错误的名称空间URI.应该是:

  1. 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

    a.将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屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆