Servlet没有加载index.hml

时间:2018-03-28 19:36:28

标签: java servlets

我创建了一个简单的servlet,它在访问所需的URL时显示“Hello World”但我无法将其加载为index.html,看起来像

<html>
<head>
    <meta http-equiv="refresh" content="0; url=/test/say_hi" />
</head>
<body></body>
</html>

web.xml看起来像:

<context-param>
    <param-name>app.version</param-name>
    <param-value>1.0.000</param-value>
</context-param>

<context-param>
    <param-name>app.properties</param-name>
    <param-value>/usr/local/tomcat/default/myapp/configInfo.properties</param-value>
</context-param>   

<servlet>
    <servlet-name>javax.ws.rs.core.Application</servlet-name>
</servlet>

<servlet-mapping>
    <servlet-name>javax.ws.rs.core.Application</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<session-config>
    <session-timeout>
        480
    </session-timeout>
</session-config>

<welcome-file-list>
    <welcome-file>index.html</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>

<listener>
    <listener-class>com.my.app.testService.ServiceContextListener</listener-class>
</listener>

Tomcat设置为以http://localhost:8080/test打开浏览器,并将test.war的工件应用程序上下文部署设置为/test。部署之后会为404 Not Found请求抛出http://localhost:8080/test,我希望服务器加载index.html

当我以http://localhost:8080/test/say_hi手动访问它时,它可以正常工作。

我做错了什么?

0 个答案:

没有答案