由于某种原因,我的Primefaces没有呈现,我正在运行Eclipse和Tomcat。
正如您在下面的图片中看到的那样,这是一个包含一些假数据的测试表,并且没有正确显示该表。
如果我将<p:dataTable>
更改为<h:dataTable>
,则可以正常使用。
正如你所看到的那样,由于某种原因,顶部有一个commandButton没有primefaces主题。
谢谢你们!
my ExpensesList.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:mp="http://primefaces.org/ui/material">
<h:form>
<h:messages />
<p:commandButton value="teste" />
<p:dataTable id="expenses" value="#{expensesController.dao.listAll()}" var="obj"
frame="box" rules="all" cellpadding="8">
<p:column headerText="Date">
<f:facet name="header">Date</f:facet>
<h:outputText value="#{obj.date}" />
</p:column>
<p:column headerText="costCenter">
<h:outputText value="#{obj.costCenter}" />
</p:column>
<p:column headerText="Description">
<h:outputText value="#{obj.description}" />
</p:column>
<p:column headerText="Diaria">
<h:outputText value="#{obj.diaria}" />
</p:column>
<p:column headerText="KM">
<h:outputText value="#{obj.km}" />
</p:column>
</p:dataTable>
</h:form>
</ui:composition>
我的Web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>rd</display-name>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>enable</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>vader</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
</web-app>
答案 0 :(得分:1)
琐碎的错误。
在xhtml上添加了DEFAULT
,在pom.xml文件中添加了主要面孔的所有主题:
<h:head></h:head>