PrimeFaces组件无法识别且无法渲染 [英] PrimeFaces components are not recognized and don't render
问题描述
我刚刚将PrimeFaces 3.0添加到了JSF项目中:
I just added PrimeFaces 3.0 to a JSF project:
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.0</version>
</dependency>
我创建了此测试页:
<!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: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.prime.com.tr/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</h:head>
<h:body>
<h:form>
<p:panel header="F.C. Barcelona" footer="Visca el Barca!">
<h:outputText value="FC Barcelona " />
</p:panel>
<h:outputText id="name" value="#{facesBean.name}" /> <h:commandButton value="Submit" action="#{facesBean.callService()}" />
</h:form>
</h:body>
</html>
但未渲染<p:panel>
组件.只有<h:xxx>
组件可以正确渲染.
But the <p:panel>
component is not rendered. Only the <h:xxx>
components are properly rendered.
我在Maven依赖区和目标文件夹中都有PrimeFaces jar.我正在使用Tomcat7.PrimeFaces不需要任何其他配置,对吗?
I have PrimeFaces jar in Maven dependecies and in the target folder. I'm using Tomcat 7. PrimeFaces doesn't need any additional configuration, right?
推荐答案
xmlns:p="http://primefaces.prime.com.tr/ui"
此XML名称空间仅适用于PrimeFaces2.x.从PrimeFaces 3.0开始,新的XML名称空间是
This XML namespace is for PrimeFaces 2.x only. Since PrimeFaces 3.0, the new XML namespace is
xmlns:p="http://primefaces.org/ui"
确保您正在阅读有关PrimeFaces 3.0而不是2.x的文档/教程.
Make sure that you're reading documentation/tutorials concerning PrimeFaces 3.0, not 2.x.
这篇关于PrimeFaces组件无法识别且无法渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!