0
我剛剛下載了Tomcat 7.0.53,並用Mojarra 2.0.3實現編寫了我的第一個JSF2.0 Hello World XHTML文件(helloworld.xhtml)。
我的web.xml文件是:我的第一個JSF xhtml正在顯示空白頁
<?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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>webroot</display-name>
<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>
</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_2_0.xsd"
version="2.0">
</faces-config>
我的WebContent/WEB-INF/lib文件夾包含以下jar文件:
jsf-api.jar
jsf-impl.jar
jstl.jar
standard.jar
我的helloworld.xhtml的代碼是:
當我運行這個使用
http://localhost:8080/webroot/helloworld.faces
它顯示了一個空白頁。出了什麼問題?
是否至少有一個標題? – 2014-11-21 20:53:38
通常情況下,您可以在web.xml中映射* .xhtml並調用localhost:8080 /.../ helloworld.xhtml。 「* .faces」來自JSF1天 – 2014-11-21 21:30:37