简体   繁体   English

netbeans没有为此命名空间找到的库

[英]netbeans no library found for this namespace

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/ui declared with prefix p but no taglibrary exists for that namespace.". 所以新的taglib和p:tagCloud行是netbeans说不起作用的 - 当我运行程序时,我看到消息上方的3个按钮“警告:此页面调用XML命名空间http://primefaces.org/ui声明为前缀p但该命名空间不存在taglibrary。“

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. 我有primefaces-3.0.M3.jar作为本地依赖 - 这似乎没问题,因为使用该库的所有java类文件都引用它。 The primefaces-3.0.M3.jar binary is also in my WEB-INF/lin folder. primefaces-3.0.M3.jar二进制文件也在我的WEB-INF / lin文件夹中。 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. 我见过很多人都遇到过netbeans的奇怪问题,我不确定我是不是只是遗漏了某些东西,或者是不是它的IDE。 Any ideas would be greatly appreciated. 任何想法将不胜感激。

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

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

This is the solution: 这是解决方案:

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

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. 因此,您必须复制所有代码(无论如何) .xhtml并重新创建它,粘贴您编写和运行的代码。

In other words, you must recreate the file that is giving you problems. 换句话说,您必须重新创建给您带来问题的文件。

The xmlns is wrong for the Primefaces component. Primefaces组件的xmlns是错误的。 Try changing the url to http://primefaces.prime.com.tr/ui as per the Primefaces Getting Started guide . 尝试根据Primefaces入门指南将网址更改为http://primefaces.prime.com.tr/ui

UPDATE 08-08-2013: 更新08-08-2013:

As of this moment the correct namespace as listed in the following link is: 到目前为止,以下链接中列出的正确命名空间是:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM