警告:此页面调用以前缀p声明的XML名称空间http://primefaces.org/ui但该名称空间不存在taglibrary

时间:2015-04-25 20:11:48

标签: maven jsf primefaces glassfish-4.1

总之,当我在GL-Server(4.1)上部署我的JSF项目时,我收到消息:警告:此页面调用以前缀p声明的XML名称空间http://primefaces.org/ui,但该名称空间不存在taglibrary

http://s29.postimg.org/km7nd8b47/primefaces.png

我几乎尝试过:创建一个新项目,删除GL-Server,重新安装Maven,用eclipse清理项目等等。

我相信我的项目中必定存在配置错误。一开始一切正常,但后来发生了这个错误。我可以通过创建一个新项目来解决它一段时间,但错误又来了(是因为我在项目方面或其他方面选择了JPA?)

这是我的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
         http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.saphirwerk</groupId>
    <artifactId>configurator</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>configurator</name>
    <packaging>war</packaging>
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.6.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.6.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.5.6-Final</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.5.6</version>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.3.2</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>configurator</finalName>
    </build>
</project>

我的首页:

<ui:composition template="/template.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <ui:define name="header">
        <h1>#{texts.titleIndex}</h1>
    </ui:define>

    <ui:define name="content">
        <h:panelGrid styleClass="selectionHome" columns="2">

            <h:panelGrid styleClass="selectionHome" columns="2">
                <p:link outcome="searchStd">
                    <p:graphicImage name="images/feeler/Taster-sketch-1_Ohne.png"
                        width="400" height="180" title="#{texts.buttonStd}" />
                </p:link>
                <p:link outcome="searchStd2">
                    <p:graphicImage name="images/feeler/Taster-sketch-2_Ohne.png"
                        width="400" height="180" />
                </p:link>

                <p:outputLabel value="#{texts.buttonStd}" />
                <p:outputLabel value="#{texts.buttonStd2}" />

                <p:link outcome="searchPin">
                    <p:graphicImage name="images/feeler/Taster-sketch-4_Ohne.png"
                        width="400" height="180" />
                </p:link>
                <p:link outcome="searchPin2">
                    <p:graphicImage name="images/feeler/Taster-sketch-5_Ohne.png"
                        width="400" height="180" />
                </p:link>

                <p:outputLabel value="#{texts.buttonPin}" />
                <p:outputLabel value="#{texts.buttonPin2}" />

                <p:link outcome="searchZylinder">
                    <p:graphicImage name="images/feeler/Taster-sketch-6_Ohne.png"
                        width="400" height="180" />
                </p:link>
                <p:link outcome="searchPlate">
                    <p:graphicImage name="images/feeler/Taster-sketch-7_Ohne.png"
                        width="400" height="180" />
                </p:link>

                <p:outputLabel value="#{texts.buttonPin}" />
                <p:outputLabel value="#{texts.buttonPlate}" />

                <p:link outcome="searchHollow">
                    <p:graphicImage name="images/feeler/Taster-sketch-8_Ohne.png"
                        width="400" height="180" />
                </p:link>
                <p:link outcome="searchStar">
                    <p:graphicImage name="images/feeler/Taster-sketch-9_Ohne.png"
                        width="400" height="180" title="#{texts.buttonStar}" />
                </p:link>

                <p:outputLabel value="#{texts.buttonHollow}" />
                <p:outputLabel value="#{texts.buttonStar}" />
            </h:panelGrid>
        </h:panelGrid>

    </ui:define>

</ui:composition>

themplate

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">

<h:head>
    <title>SAPHIRWERK AG</title>
    <h:outputStylesheet name="/style.css" />
</h:head>

<h:body>
    <div id="container">
        <div id="center">
            <ui:insert name="center">
                <div id="header">
                    <ui:insert name="header"></ui:insert>
                </div>
                <div id="menu">
                    <ui:insert name="menu">
                        <ui:include src="/menu.xhtml" />
                    </ui:insert>
                </div>
                <div id="content">
                    <ui:insert name="content"/>
                </div>
            </ui:insert>
        </div>
        <div id="left">
            <ui:insert name="left"/>
        </div>
        <div id="right">
            <ui:insert name="right"/>
        </div>  
    </div>
</h:body>
</html>

至少是web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
         http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

    <display-name>Konfigurator Saphirwerk AG</display-name>

    <servlet>
        <servlet-name>FacesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
        <param-value>TRUE</param-value>
    </context-param>

</web-app>

感谢您的回答。如果您需要更多信息,请告诉我。

2 个答案:

答案 0 :(得分:1)

看起来缺少Primefaces的依赖项。在 @OneToOne( optional = true, cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn( name = "current_child_id", nullable = false ) @ForeignKey( name = "FK_parent_child" ) private Child currentChild;

中添加以下内容
pom.xml

答案 1 :(得分:-2)

这是部署问题。创建项目后, 将其添加到index.xhtml页面xmlns:p="http://primefaces.org/ui" 右键单击项目&gt; 属性&gt; 框架 添加&gt; Java Server Faces &gt; 在“组件”标签上,选择“Primefaces”&gt;的确定

右键单击项目,然后选择依赖于构建

尝试一下