【发布时间】:2017-01-09 21:10:23
【问题描述】:
我正在尝试在运行动态 Web 项目后显示欢迎页面。 谷歌搜索时,我发现了很多教程,但我找不到解决方案。 我分享:
- 我项目的structure(我希望页面welcome.xhtml默认显示)。
- 文件
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_3_0.xsd"
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>HiSpring</display-name>
<welcome-file-list>
<welcome-file>welcome.xhtml</welcome-file>
</welcome-file-list>
<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>
<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>
一旦点击HiSpring > Run As > Run on Server,我应该有
这个网址:http://localhost:8080/HiSpring/faces/welcome.xhtml。但是,我得到了http://localhost:8080/HiSpring/。
你能告诉我我错过了什么吗?提前致谢。
【问题讨论】:
-
你用的是什么技术?
-
你好@kometen,我正在使用JEE6技术。
-
嗨@Sofia,谢谢。除了欢迎文件之外,请将它们添加到列表中。像 java、servlet 等。
-
嗨@kometen,非常感谢您的回复。如果你不介意,你能给我举个例子吗?
-
很抱歉我不能。不知道你用的是什么技术。在询问之前,您必须提供足够的信息,然后人们才能帮助您。如网络服务器、语言等
标签: spring jsf tomcat7 welcome-file