netbeans 找不到此命名空间的库
我四处寻找但无法找到明确的解决方案。我正在使用 netbeans+Maven 并尝试从 Primefaces 2.2.1 升级到 3.0.M3 - 当我将 index.xhtml taglib 更改为 xmlns:p="http://primefaces.org/ui" 时,netbeans 会抛出 '找不到此命名空间的库”错误。
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>
因此,新的 taglib 和 p:tagCloud 行是 netbeans 所说的不起作用 - 当我运行程序时,我看到消息上方的 3 个按钮“警告:此页面调用 XML 命名空间 http://primefaces.org/ui 使用前缀 p 声明,但该命名空间不存在标记库。”。
对于 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>
并注释掉了旧的 prime-repo 存储库信息。
我已经将 primefaces-3.0.M3.jar 作为本地依赖项 - 这似乎没问题,因为使用该库的所有 java 类文件都可以引用它。 primefaces-3.0.M3.jar 二进制文件也在我的 WEB-INF/lin 文件夹中。我见过很多人在使用 netbeans 时遇到奇怪的问题,并且不确定我是否只是遗漏了某些东西或者它是否是 IDE。任何想法将不胜感激。
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.
The index.xhtml file is:
<?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/ui declared with prefix p but no taglibrary exists for that namespace.".
For Maven I've updated these parts of the 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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
实际上,如果您使用的是 Primefaces 3.0 M4,则 xmlns 更改为:
Actually if you are using Primefaces 3.0 M4 then the xmlns changed to:
解决方案如下:
框架
。JavaServer Faces
。Components
PrimeFaces
这解决了问题。但是,错误图标仍然会出现在我们项目的左侧面板中。 (不在代码中)。因此,您必须复制所有代码(无论什么)
.xhtml
并重新创建它,粘贴您编写的代码并运行。换句话说,您必须重新创建给您带来问题的文件。
This is the solution:
Frameworks
.JavaServer Faces
.Components
PrimeFaces
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)
.xhtml
and recreate it, paste the code you wrote and run.In other words, you must recreate the file that is giving you problems.
Primefaces 组件的
xmlns
是错误的。尝试按照 Primefaces 入门指南。更新 08-08-2013:
截至目前,以下链接中列出的正确命名空间是:
The
xmlns
is wrong for the Primefaces component. Try changing the url tohttp://primefaces.prime.com.tr/ui
as per the Primefaces Getting Started guide.UPDATE 08-08-2013:
As of this moment the correct namespace as listed in the following link is:
如果有人仍在寻找答案,
只需右键单击您的 EE 项目 ->选择项目属性->框架->组件并选择primfaces。
适用于 Netbeans 8.1
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.
works on Netbeans 8.1