2012-03-12 35 views
3

我發現了類似的問題here,但它不再幫助我。但是我面臨同樣的問題。當運行我的應用程序得到followine錯誤:沒有與PrimeFaces命名空間關聯的TagLibrary

警告:頁面/template/common.xhtml聲明命名空間http://primefaces.org/ui和使用標籤號碼:面板,但沒有相關的命名空間標記庫。

下面是我的index.xhtml的一個片段:

<ui:composition template="/template/common.xhtml" 
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:p="http://primefaces.org/ui"> 

    <ui:define name="profile">  

這是我common.xhtml文件看起來如何(不要把全部內容,只是命名空間和1-2行):

<!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:ui="http://java.sun.com/jsf/facelets" 
    xmlns:p="http://primefaces.org/ui"> 
<h:head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <title>Welcome to my website</title> 
    <h:outputStylesheet library="css" name="default.css" /> 
</h:head> 
<h:body> 
    <div id="header" style="margin: auto; width: 80%;"> 
     <p:panel> 

正如BalusC在here所述,必須定義xmlns =「http://www.w3.org/1999/xhtml」。我也這樣做。即index.xhtml文件的第二行也是這樣做的。但我仍然有錯誤。

回答

5

您的webapp的/WEB-INF/lib文件夾中缺少PrimeFaces 3.x JAR文件。 Download並放在那裏。或者,如果你使用PrimeFaces 2.x的,那麼你就應該使用下面的XML命名空間,而不是:

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

這裏面你要鏈接到不談論<p:xxx>標籤,但對普通的其他問題HTML標籤如<title>,<div>等。這只是巧合,如果其他問題<input>被放在<p:panel>之內。

+0

okkkk BalusC ...我有primefaces3.1下載但它不在/ WEB-INF/lib文件夾中。讓我再次部署我的應用程序...無論如何感謝你這樣一個快速的答覆。 – 2012-03-12 20:41:39

+1

BalusC,它的工作完美。非常感謝。愛。 – 2012-03-12 20:57:16

+0

不客氣。 – BalusC 2012-03-12 20:58:29