简体   繁体   中英

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.

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.

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

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

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

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.

The xmlns is wrong for the Primefaces component. Try changing the url to http://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:

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.

works on Netbeans 8.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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