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

问题描述 投票:3回答:2

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

警告:页面/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">    

这就是我的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文件的第二行也是如此。但我仍然得到错误。

jsf-2 primefaces websphere xml-namespaces
2个回答
5
投票

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

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

您链接到的另一个问题不是讨论<p:xxx>标签,而是关于<title><div>等纯HTML标签。只是巧合,在其他问题的情况下,<input>被放置在<p:panel>内。


-1
投票

只需从Java2s primefaces jar downloads下载jar,然后将jar添加到项目中的libraries文件夹中

© www.soinside.com 2019 - 2024. All rights reserved.