2012-03-21 95 views
1

我只是說PrimeFaces 3.0到JSF項目:PrimeFaces組件不認可,不渲染

<repository> 
    <id>prime-repo</id> 
    <name>PrimeFaces Maven Repository</name> 
    <url>http://repository.primefaces.org</url> 
    <layout>default</layout> 
</repository> 

<dependency> 
     <groupId>org.primefaces</groupId> 
    <artifactId>primefaces</artifactId> 
    <version>3.0</version> 
</dependency> 

我創造了這個測試頁面:

<!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.prime.com.tr/ui"> 
    <h:head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
    </h:head> 
    <h:body> 
     <h:form> 
      <p:panel header="F.C. Barcelona" footer="Visca el Barca!"> 
       <h:outputText value="FC Barcelona " /> 
      </p:panel> 

      <h:outputText id="name" value="#{facesBean.name}" />    <h:commandButton value="Submit" action="#{facesBean.callService()}" /> 
     </h:form> 
    </h:body> 
</html> 

<p:panel>組件不渲染。只有<h:xxx>組件被正確渲染。

我有Maven依賴項和目標文件夾中的PrimeFaces jar。我正在使用Tomcat 7. PrimeFaces不需要任何額外的配置,對吧?

回答

2
xmlns:p="http://primefaces.prime.com.tr/ui" 

此XML命名空間僅適用於PrimeFaces 2.x。由於PrimeFaces 3.0,新的XML命名空間是

xmlns:p="http://primefaces.org/ui" 

確保您正在閱讀有關PrimeFaces 3.0文檔/教程,而不是2.x版本

+1

W ...謝謝! – 2012-03-21 20:17:16