Facelets parsing problem using JBoss v4.2.1
I have a some.xhtml file with jsf libs in it. In <h:body>
tag I am trying to display 2 words:
For the first one I use plain text: Hello
For the second one I use: <h:outputText value=" there"/>
I expect to see "Hello there", but only Hello is printed on the page. So I assume that the facelet is not parsed somehow in JBoss 4.2.1. It worked Apache 7. How can I fix it. May be something must be added to the web.xml
or faces-config.xml
files?
Thanks in advance
P.S. I open the page like this: 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:b开发者_开发问答ody>
</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>
JBoss 4.2 ships with a bundled JSF 1.2 implementation which will by default always get precedence over any JSF implementation which you include in your WAR. JSF 1.2 does by default not recognize Facelets as view technology, nor does it support any JSF 2.0 specific tags like <h:body>
.
To tell JBoss that your WAR already bundles a JSF implementation, so that JBoss won't use its bundled JSF 1.2 for your webapp, you need to add the following context parameter to your web.xml
:
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
Open the page with .jsf suffix or /faces/ Which ever you defined in web.xml
精彩评论