Search code examples
jsf-2primefaces

PrimeFaces tags not recognised


I am new to JSF and Primefaces and have created a project with JSF2.0, Glassfish v3.0 and Jdk 6.0.Now want to use Primefaces tags instead of JSF tags. I have downloaded primefaces-3.5.jar and added it into WEB-INF/lib folder and it well recognized into my *.xhtml pages.

But when I try to run the application it does not recognizes the PrimeFaces tags. for Example: if I insert:

<p:inputText id="username" validator="#{regBean.username}" required="true" requiredMessage="Please enter Username"/>

instead of:

<h:inputText id="username" value="#{regBean.username}" required="true" requiredMessage="Please enter Username!"/>

it does not show the input box in the Web Application. Do I need to include any configuration details in web.xml file? please suggest!!


Solution

  • Try something like

    <?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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
    
    <h:head>
    
    </h:head>
    <h:body>
        <h:form>
     <p:editor></p:editor>
        </h:form>
    </h:body>
    </html>
    

    Also make sure you have primefaces.jar in your path.