2011-09-20 41 views
0

我有一個帶有jsf庫的some.xhtml文件。在<h:body>標籤,我想顯示2個字:使用JBoss v4.2.1 Facelets解析問題

這是第一個我使用純文本:你好

對於第二個我用:<h:outputText value=" there"/>

我希望看到「你好」,但只有你好打印在頁面上。所以我認爲在JBoss 4.2.1中不會對facelet進行解析。它運行了Apache 7.我該如何解決它。可能是一些必須添加到web.xmlfaces-config.xml文件?

在此先感謝

附:我打開網頁是這樣的:http://localhost:8080/ProjectName/faces/some.xhtml

some.xhtml

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

    <h:head> 
     <title>Title that rocks</title> 
    </h:head> 

    <h:body> 
     Hello 
     <h:outputText value=" there" /> 
    </h:body> 
</html> 

web.xml

<?xml version="1.0" encoding="UTF-8"?> 
<web-app id="WebApp_ID" version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 
    <context-param> 
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
     <param-value>.xhtml</param-value> 
    </context-param> 
    <listener> 
     <listener-class>com.sun.faces.config.ConfigureListener</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>/faces/*</url-pattern> 
    </servlet-mapping> 
    <welcome-file-list> 
     <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 
</web-app> 

faces-config.xml

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

<faces-config 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" 
    version="1.2"> 

</faces-config> 
+1

這與JSTL完全無關。我編輯了你的問題和標籤。 JSTL是一個JSP標準標籤庫,它是那些''標籤等等。另請參閱http://download.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/您實際上是指「JSF標籤」或「Facelets標籤」,而不是「Facelets JSTL」。 – BalusC

回答

0

的JBoss 4.2附帶捆綁JSF 1.2實現,這將默認總是優先於任何JSF實現它在您的WAR包括。 JSF 1.2默認不會將Facelets識別爲視圖技術,也不支持任何JSF 2.0特定標籤,如<h:body>

告訴JBoss的是你的戰爭已經捆綁了JSF的實施,使JBoss會不會利用其捆綁JSF 1.2你的web應用,你需要以下上下文參數添加到您的web.xml

<context-param> 
    <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name> 
    <param-value>true</param-value> 
</context-param> 
0

公開賽.jsf後綴的頁面或/面/ 曾經在web.xml中定義了