我有一个使用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