【发布时间】:2015-02-11 16:53:55
【问题描述】:
我将 Jetty 8.1.4 与 Spring 3.2.4 一起使用。以下是我的 web.xml 文件。我在 WEB-INF 下有一个 index.html 文件,当我执行 http://myapp.com/ 或简单的 http://myapp.com 时,我希望该页面被点击,但我得到 404。如果我执行 http://myapp.com/index.html 它可以工作。我不确定我错过了什么。另外,如果我必须在下面的 url 模式中使用 / 或 /* 我有点困惑,我都尝试了。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="DOMAINAPPROVALGUI" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>myapp-ui</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/myapp-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<session-config>
<session-timeout>10</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>myappname</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myappname</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
【问题讨论】:
标签: java spring spring-mvc jetty web.xml