【发布时间】:2011-06-04 10:03:25
【问题描述】:
我想在 Eclipse 3.6 中创建 JSF 2.0 项目,我想将它部署在 Websphere Application Server Community Edition 2.1 上。
我创建了一个简单的网络项目。
在index.html我写了这段代码
<!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>JSF 2.0</title>
</h:head>
<h:body>
jsf welcome
</h:body>
</html>
但<h:body> 和<h:body> 标签之间的文字在页面中看不到。我该如何解决这个问题?
这是构建路径:
这是web.xml 文件
<?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>JSFApp</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<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>
<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>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
</web-app>
有什么错误吗?
【问题讨论】:
-
尝试从项目设置中为 JSF 2.0 添加构面。如果没有其他可以为您添加有用的验证。
-
@erloewe:考虑到 Libraries 屏幕截图中的 JSF 条目和
web.xml中的(糟糕的)Eclipse-default/faces/*url 模式,可能已经添加了构面。 -
@Balusc 这些东西是在我出现后添加到问题中的 :) 只是确保,只是确保......顺便说一句很好的答案。
-
@erloewe:抱歉,我现在看到了时间戳。谢谢你:)
标签: jsf-2 websphere eclipse-3.6