没有TagLibrary与PrimeFaces的命名空间相关联

Rav*_*shi 4 websphere xml-namespaces primefaces jsf-2

我在这里发现了类似的问题,但它不再帮助我了.但是我面临同样的问题.在运行我的应用程序时,我收到以下错误:

警告:页面/template/common.xhtml声明命名空间http://primefaces.org/ui并使用标记p:panel,但没有与命名空间关联的TagLibrary.

下面是我的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">    
Run Code Online (Sandbox Code Playgroud)

这就是我的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>
Run Code Online (Sandbox Code Playgroud)

正如BalusC在这里所描述的那样,必须定义xmlns ="http://www.w3.org/1999/xhtml".我也是这样做的.即index.xhtml文件的第二行也是这样做的.但我仍然得到错误.

Bal*_*usC 5

您的webapp /WEB-INF/lib文件夹中缺少PrimeFaces 3.x JAR文件.下载并放入其中.或者,如果您使用的是PrimeFaces 2.x,那么您应该使用以下XML命名空间:

xmlns:p="http://primefaces.prime.com.tr/ui"
Run Code Online (Sandbox Code Playgroud)

您链接到的另一个问题不是关于<p:xxx>标签,而是关于纯HTML标签<title>,<div>等等.只是巧合,如果其他问题<input>被放在一个<p:panel>.