0
votes

I'm trying to make a project with primefaces but i can't make it work , the tags are not being rendered. Here is what i've got:

Problem : enter image description here

welcome.xhtml :

<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.prime.org/ui"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  >

<h:head>
    <title>Ejemplo</title>
     <link rel="stylesheet" type="text/css" href="css/styles.css"/>
</h:head>
<h:body>
<center>
    <h:form>
    <div id="header">
        <h1><h:outputLabel value="#{login.msg}"/></h1>

    </div>
    <div id="body">
            <p:growl id="messages"/>

            <p:menubar>
                <p:submenu label="File" icon="ui-icon-document">
                    <p:submenu label="New" icon="ui-icon-contact">
                        <p:menuitem value="Project" url="#" />
                        <p:menuitem value="Other" url="#" />
                    </p:submenu>
                    <p:menuitem value="Open" url="#" />
                    <p:separator />
                    <p:menuitem value="Quit" url="#" />
                </p:submenu>

                <p:submenu label="Edit" icon="ui-icon-pencil">
                    <p:menuitem value="Undo" url="#" icon="ui-icon-arrowreturnthick-1-w" />
                    <p:menuitem value="Redo" url="#" icon="ui-icon-arrowreturnthick-1-e" />
                </p:submenu>

                <p:submenu label="Help" icon="ui-icon-help">
                    <p:menuitem value="Contents" url="#" />
                    <p:submenu label="Search" icon="ui-icon-search">
                        <p:submenu label="Text">
                            <p:menuitem value="Workspace" url="#" />
                        </p:submenu>
                        <p:menuitem value="File" url="#" />
                    </p:submenu>
                </p:submenu>

                <p:submenu label="Actions" icon="ui-icon-gear">
                    <p:submenu label="Ajax" icon="ui-icon-refresh">
                        <p:menuitem value="Save" actionListener="#{menuView.save}" icon="ui-icon-disk" update="messages"/>
                        <p:menuitem value="Update" actionListener="#{menuView.update}" icon="ui-icon-arrowrefresh-1-w" update="messages"/>
                    </p:submenu>
                    <p:submenu label="Non-Ajax" icon="ui-icon-newwin">
                        <p:menuitem value="Delete" actionListener="#{menuView.delete}" icon="ui-icon-close" update="messages" ajax="false"/>
                    </p:submenu>
                </p:submenu>

                <p:menuitem value="Quit" url="http://www.primefaces.org" icon="ui-icon-close" />

                <f:facet name="options">
                    <p:inputText style="margin-right:10px" placeholder="Search"/>
                    <p:commandButton type="button" value="Logout" icon="ui-icon-extlink" />
                </f:facet>
            </p:menubar>
    </div>  
    </h:form>
</center>
</h:body>

web.xml :

<?xml version="1.0" encoding="UTF-8"?>

<display-name>JavaServerFaces</display-name>

<!-- Change to "Production" when you are ready to deploy -->
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>

<!-- Welcome page -->
<welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>

<!-- JSF mapping -->
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>


</servlet>


<!-- Map these files with JSF -->
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

This is the warning that comes up : - Warning: The page /welcome.xhtml declares namespace http://primefaces.prime.org/ui and uses the tag p:commandButton , but no TagLibrary associated to namespace. Please check the namespace name and if it is correct, it is probably that your library .taglib.xml cannot be found on the current classpath, or if you are referencing a composite component library check your library folder match with the namespace and can be located by the installed ResourceHandler.!

The libs are properly imported. I'm using eclipse with Tomcat.

libs

1
Where did you learn/read that xmlns:p="http://primefaces.prime.org/ui" is the right one? I'm at least not seeing that anywhere in PrimeFaces own documentation.BalusC
Hi , thanks for the comment pls make it an answer so i can mark it as the correct one . i did try with others and didn't work maybe at that time i was importing the jars wrong or somethinguser3889392
i just used this one xmlns:p="primefaces.org/ui" and workeduser3889392
Sorry, but where did you learn/read that xmlns:p="http://primefaces.prime.org/ui" is the right one? Your question namely implies that you didn't believe the error message and thus you should already have taken the effort to verify if that would be the right one.BalusC
I did take the effort to verify it , yesterday i spended almost 5 hours on that and i kept getting the same error no matter what i coded on that line . i read it on a tutorial but i can't find the link . thanks for the help i didn't want to post beacuse i knew it would be some dumb error like that but i coudn't find the solution(like i said yesterday i may have not imported the library correctly).user3889392

1 Answers

0
votes

Just to close the post , @Balus C helped the problem was

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

changed it to

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