PrimeFaces tags not recognised

半世苍凉 提交于 2019-12-13 04:42:43

问题


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!!


回答1:


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.



来源:https://stackoverflow.com/questions/16542224/primefaces-tags-not-recognised

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!