Java webapps - 访问webapps根目录时为什么会显示index.html?

时间:2015-09-15 13:16:39

标签: java tomcat servlets web-applications

假设您在localhost中的Tomcat上部署了名为MyWebApp的Web应用程序。如果您使用浏览器访问它,请执行以下操作:

localhost:8080/MyWebApp

那么为什么会显示index.html(假设.war文件中有index.html)?

是否有某个配置通过发送index.html来响应/MyWebApp的请求?是否可以更改该配置?为什么没有处理此请求的servlet?

1 个答案:

答案 0 :(得分:2)

index.html页面在web.xml文件中指定为欢迎页面。

看起来像这样: -

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>

这就是您将index.html视为欢迎页面的原因。

相关问题