我有一個使用Primefaces正確渲染數據表的probem:渲染只是一個純文本,沒有正常的Primefaces圖形(沒有替代顏色行等)。 我想明白爲什麼,因爲所有其他幾頁都很好地呈現在我的網站上。Primefaces渲染問題
這裏的頁面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:body>
<h:form>
<p:dataTable var="c" value="#{viewContattoBean.contatto}">
<p:column headerText="Nome">
<h:outputText value="#{c.contattoid}" />
</p:column>
<p:column headerText="Telefono">
<h:outputText value="#{c.numero}" />
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
這裏的XHTML是在web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>RubricaWeb</display-name>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.xhtml</form-login-page>
<form-error-page>/loginerror.xhtml</form-error-page>
</form-login-config>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Admins Pages</web-resource-name>
<description />
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Users Pages</web-resource-name>
<description />
<url-pattern>/user/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
的問題,就像我已經sayd是我想象像純文本的表,但內容是正確的(這就是爲什麼我認爲不是有用的向你展示託管bean)。
感謝大家。
您是否應用了主題?如果你沒有主題,那麼就沒有什麼樣的設計元素,我會害怕知道它是什麼樣的。看看primefaces中的主題。 – VeenarM
是的,我安裝了它。實際上有些頁面我通常可視化(帶有主題),但其他一些我只看到純文本。 – Samuele