tomcat - JSF 站点在浏览器上为空白
问题描述
为了我的学习,我尝试编写一个 JSF 站点。我创建了一个像 Hello World 这样的新项目。但是,如果我运行该项目,我会得到一个空白站点并且没有错误。
这是我的代码:
索引.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://xmlns.jcp.org/jsf/html">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:outputText value="Test"></h:outputText>
</h:body>
</html>
Web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<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>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
有人能帮我吗?
谢谢!
解决方案
推荐阅读
- angular - 通过 ngrx select 检查多个值的保护
- arrays - 使用 Swift sorted(by:) 方法时数组排序不正确
- devise - 使用 capybara 自动化测试为 Google Oauth 2 的登录存根
- scala - Scala - 如何将字符串值传递给数据框过滤器(Spark-Shell)
- knime - Knime HDFS 连接节点不工作
- ruby-on-rails - Rails 将 json 渲染到 AngularJS 前端。时间变为 00:00:00
- python - ValueError:轮廓级别必须增加 - 已排序的数组
- python - 从单个导入访问 python 应用程序中的全局变量
- java - JLabels 在 Mac 上具有透明背景,但在 Windows 上却没有?
- sql - 如何在 Crystal Report 中使用的 SQL 语句的 Where 子句中使用参数?