【发布时间】:2011-12-13 05:56:18
【问题描述】:
我正在从 coreservlets 站点测试应用程序“jsf-blank”以了解 jsf 的工作原理,但我的浏览器没有显示 xhtml 页面的内容。
我使用 Tomcat 6 和 Eclipse Indigo。
你知道为什么我的浏览器页面是空白的吗?
感谢您的帮助。
谢谢,但它不适用于 jsp 指令,这是我的 web.xml 的内容:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
最后更新:
我尝试了你的解决方案,但我遇到了同样的问题,jsf 标签不是由浏览器呈现的(我是 JSF 的新手)。
我的测试很简单:
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"
version="2.5">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
index.xhtml:
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title><h:outputText value="First JSF Application" /></title>
</h:head>
<h:body>
<h:outputText value="Test" />
</h:body>
</html>
上下文名称:jsf-blank
我用 url 测试:http://localhost:8080/jsf-blank/index.xhtml
结果:空白页
最后更新:
谢谢,我的问题解决了,我想问题的根源是我的tomcat文件夹shared/lib中的rich-faces 3.3 jars。
我删除了这些罐子,现在它可以工作了,你知道为什么会出现问题吗?
【问题讨论】:
标签: jsf-2