问题描述
我想作一个简单的数据表只是分页功能,但我有2个问题:
I want to make a simple datatable just with the pagination feature, but i have 2 problems:
1时显示的数据,但分页程序没有在浏览器中显示(我试过IE和Chrome)
1- The data is displayed but the paginator is not shown in the browser(I tried IE and chrome)
<p:dataTable var="garbage" value="#{resultsController.allGarbage}" paginator="true" rows="10">
<p:column>
<f:facet name="header">
<h:outputText value="Filename" />
</f:facet>
<h:outputText value="#{garbage.filename}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Description" />
</f:facet>
<h:outputText value="#{garbage.description}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Upload date" />
</f:facet>
<h:outputText value="#{garbage.uploadDate}" />
</p:column>
</p:dataTable>
2 - 谷歌浏览器分页程序仍无法显示,同时我看到我每次刷新时的一些交流中心对话框:
2- In google chrome paginator still is not displayed and also i see some extrange dialog every time i refresh:
这是否意味着primefaces是不是与铬兼容?
Does this mean that primefaces is not compatible with chrome?
------------------------更新1 --------------------- ---------
------------------------UPDATE 1------------------------------
这是它的外观保持页:
<ui:composition template="WEB-INF/templates/BasicTemplate.xhtml">
<ui:define name="resultsForm">
<h:form enctype="multipart/form-data">
<h:inputText id="search" value="" /><h:commandButton value="search"/>
<h:selectOneRadio id="searchFilter" value="" >
<f:selectItem id="r1" itemLabel="text documents(.pdf, .docx ...)" />
<f:selectItem id="r2" itemLabel="audio(.mp3,.wav...)" />
<f:selectItem id="r3" itemLabel="multimedia(.mpeg,flv...)" />
<f:selectItem id="r4" itemLabel="other..." />
</h:selectOneRadio>
<p:dataTable var="garbage" value="#{resultsController.allGarbage}" paginator="true" rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15">
<p:column>
<f:facet name="header">
<h:outputText value="Filename" />
</f:facet>
<h:outputText value="#{garbage.filename}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Description" />
</f:facet>
<h:outputText value="#{garbage.description}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Upload date" />
</f:facet>
<h:outputText value="#{garbage.uploadDate}" />
</p:column>
</p:dataTable>
</h:form>
</ui:define>
------------------------更新2 --------------------- ---------
------------------------UPDATE 2------------------------------
这形象是如何将组件显示在Chrome和如何铬控制台显示错误:
This image is how the component is displayed in chrome and how the chrome consoles displays an error:
推荐答案
如果您没有看到任何PrimeFaces特定的CSS / JS进口生成的HTML &LT; HEAD&GT;
在浏览器(单击鼠标右键页面中,选择的查看源文件的,那么就意味着你需要替换HTML &LT; HEAD&GT;
由JSF &LT; H:。头&GT; 这即,所有资源依赖(CSS / JS /相连接的JSF组件/库的图像/等)将最终
If you don't see any PrimeFaces specific CSS/JS imports in generated HTML <head>
(rightclick page in browser, choose View Source, then it means that you need to replace the HTML <head>
in your template by JSF <h:head>
. That's namely where all resource dependencies (CSS/JS/images/etc which are connected to JSF components/libraries) will end up in.
在以前的版本PrimeFaces(在2.0以上),你还需要配置资源的servlet到PrimeFaces可以从JAR文件服务起来:
In former PrimeFaces versions (at least in 2.0) you would also need to configure a resource servlet to that PrimeFaces can serve them up from the JAR file:
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>
我但是不知道超越2.0较新版本的PrimeFaces,也是目前用户手册是出于某种原因,不是免费的了。
I'm however not sure about the newer PrimeFaces versions beyond 2.0, also currently the user manual is for some reason not free anymore.
这篇关于(JSF 2.0)与primefaces dataTable组件的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!