我正在嘗試在其網站上製作一個簡單的PrimeFaces示例,如教程。我基本上有與this user完全相同的問題,但我沒有像他那樣的空的jar文件。 h:標籤渲染正常,但p:標籤在HTML中顯示爲p:標籤。 PrimeFaces 3.1.1和3.2的相同問題。這是我的web.xml文件。Primefaces標籤在Eclipse Facelets項目中未被識別
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>jsf</display-name>
<welcome-file-list>
<welcome-file>Login.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<description></description>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description></description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description></description>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener- class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
我的XHTML文件看起來像這樣。
<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:p="http://primefaces.org/ui">
<h:head>
<title><ui:insert name="title">Facelets Tutorial</ui:insert></title>
</h:head>
<body>
<p:editor />
<p:spinner />
</body>
</html>
我開始了我的服務器(Tomcat的6)和呈現的HTML看起來像這樣,H:標籤呈現精緻和p:標籤仍然號碼:標籤。
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui"><head>
<title>Facelets Tutorial</title></head>
<body>
<p:editor></p:editor>
<p:spinner></p:spinner>
</body>
</html>
我加入了PrimeFaces罐子到我的構建路徑,我知道它是被認可的,因爲我可以導入/使用PrimeFaces類只是在我的源文件的罰款。我甚至下載了PF源並將其添加到我的項目中以確保可以看到它,而且我仍然有這個問題。我的web.xml中是否需要一些額外的配置?
這結束了爲我工作,謝謝! – json4639 2012-04-23 02:59:09