我正在尝试使用primefaces显示dataGrid,但它没有正确显示:
代码.xhtml在这里:
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/WEB-INF/templates/basic.xhtml">
<ui:define name="content">
<h:form>
<p:dataGrid value="#{data.result}" columns="3" rows="10" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15">
<p:panel header="#{article.name}" style="text-align:center">
<h:panelGrid columns="1" style="width:100%">
<p:graphicImage value="/Images/linux.jpg"/>
<h:outputText value="#{article.description}" />
</h:panelGrid>
</p:panel>
</p:dataGrid>
</h:form>
</ui:define>
</ui:composition>
</html>
我的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>PrimeFaces</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>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>bootstrap</param-value>
</context-param>
</web-app>
我在primefaces-4.0.jar
中安装了MyProject/WebContent/WEB-INF/lib/primefaces-4.0.jar
并右键点击了它&gt; Build Path
&gt; Configure Build Path...
以便我primefaces-4.0.jar
中有MyProject/Java Resources/Libraries/primefaces-4.0.jar
。我对bootstrap-1.0.10.jar
做了同样的事。
为什么这不起作用?
如果您需要更多信息,请告诉我。
--- --- UPDATE
显示网页:
http://imagesup.org/images12/1389819198-networkepimarket.png