首页 文章

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

提问于
浏览
3

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

Warning: The page /template/common.xhtml declares namespace http://primefaces.org/ui and uses the tag p:panel , but no TagLibrary associated to namespace.

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

2 回答

  • 5

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

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

    你're linking to isn'谈论 <p:xxx> 标签的其他问题,但关于纯粹的HTML标签,如 <title><div> 等 . 只是巧合的是,在其他问题的情况下, <input> 被放置在 <p:panel> 内 .

  • -1

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

相关问题