java netbeans 找不到此命名空间的库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7497251/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 20:14:04  来源:igfitidea点击:

netbeans no library found for this namespace

javajsfnetbeansmavenprimefaces

提问by Alaph432

I've searched around but cannot fine a definitive solution. I'm using netbeans+Maven and am trying to upgrade from Primefaces 2.2.1 to 3.0.M3 - when I change the index.xhtml taglib to xmlns:p="http://primefaces.org/ui" netbeans throws the 'no library found for this namespace' error.

我已经四处搜索,但无法确定一个明确的解决方案。我正在使用 netbeans+Maven 并试图从 Primefaces 2.2.1 升级到 3.0.M3 - 当我将 index.xhtml taglib 更改为 xmlns:p="http://primefaces.org/ui" 时,netbeans 会抛出 '找不到此命名空间错误的库。

The index.xhtml file is:

index.xhtml 文件是:

<?xml version="1.0" encoding="UTF-8"?>
<!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:f="http://java.sun.com/jsf/core"      
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:p="http://primefaces.org/ui" >
<f:view contentType="text/html">
    <h:head>
    </h:head>            
<h:body>
    <h:form>
        <h:commandButton value="Run Test" action="selecttype" />
        <h:commandButton value="Manage Methods" action="addmethod" />
        <h:commandButton value="Manage Data" action="managedata" />
        <p:tagCloud model="#{tagCloudBean.model}" />  
    </h:form>
</h:body>
</f:view>
</html>

So the new taglib and p:tagCloud line are what netbeans says are not working - when I run the program I see the 3 buttons above the message "Warning: This page calls for XML namespace http://primefaces.org/uideclared with prefix p but no taglibrary exists for that namespace.".

所以新的 taglib 和 p:tagCloud 行是 netbeans 所说的不起作用 - 当我运行程序时,我看到消息上方的 3 个按钮“警告:此页面调用 XML 命名空间http://primefaces.org/ui声明为前缀 p 但该命名空间不存在标签库。”。

For Maven I've updated these parts of the pom.xml:

对于 Maven,我更新了 pom.xml 的这些部分:

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

<repositories>
    <repository>
        <id>java.net.m2</id>
        <name>java.net m2 repo</name>
        <url>http://download.java.net/maven/2</url>
    </repository>

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

and commented out the old prime-repo repository info.

并注释掉旧的prime-repo 存储库信息。

I have got primefaces-3.0.M3.jar as a local dependency - this seems to be ok as all java class files using the library are referencing it ok. The primefaces-3.0.M3.jar binary is also in my WEB-INF/lin folder. I've seen a lot of people having weird issues with netbeans and am not sure if I'm simply missing something or if its the IDE. Any ideas would be greatly appreciated.

我已经将 primefaces-3.0.M3.jar 作为本地依赖项 - 这似乎没问题,因为使用该库的所有 java 类文件都可以正常引用它。primefaces-3.0.M3.jar 二进制文件也在我的 WEB-INF/lin 文件夹中。我见过很多人在使用 netbeans 时遇到奇怪的问题,但不确定我是否只是遗漏了某些东西,或者是 IDE。任何想法将不胜感激。

采纳答案by maple_shaft

The xmlnsis wrong for the Primefaces component. Try changing the url to http://primefaces.prime.com.tr/uias per the Primefaces Getting Started guide.

xmlns是错误的,Primefaces组件。尝试http://primefaces.prime.com.tr/ui根据Primefaces 入门指南将 url 更改为。

UPDATE 08-08-2013:

2013 年 8 月 8 日更新:

As of this moment the correct namespace as listed in the following link is:

截至目前,以下链接中列出的正确命名空间是:

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

回答by Stoto

Actually if you are using Primefaces 3.0 M4 then the xmlns changed to:

实际上,如果您使用的是 Primefaces 3.0 M4,那么 xmlns 更改为:

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

回答by David Escobar

This is the solution:

这是解决方案:

  1. Right click on the EE project.
  2. Click on Frameworks.
  3. Click on JavaServer Faces.
  4. Click on Components
  5. Check PrimeFaces
  6. Click OK
  1. 右键单击 EE 项目。
  2. 单击Frameworks
  3. 单击JavaServer Faces
  4. 点击 Components
  5. 查看 PrimeFaces
  6. 单击确定

This solves the problem. However, the error icon will still appear in the left panel of our project. (Not in the code). So you must copy all your code (whatever) .xhtmland recreate it, paste the code you wrote and run.

这解决了问题。但是,错误图标仍会出现在我们项目的左侧面板中。(不在代码中)。因此,您必须复制所有代码(无论如何).xhtml并重新创建它,粘贴您编写的代码并运行。

In other words, you must recreate the file that is giving you problems.

换句话说,您必须重新创建给您带来问题的文件。

回答by Helmy

in case of anyone still looking for an answer for this,

如果有人仍在为此寻找答案,

just right click your EE project -> select project properties -> Frameworks -> components and select primefaces.

只需右键单击您的 EE 项目 -> 选择项目属性 -> 框架 -> 组件并选择 primefaces。

works on Netbeans 8.1

适用于 Netbeans 8.1