gpt4 book ai didi

eclipse - 无法使用 Tomcat 启动欢迎页面

转载 作者:行者123 更新时间:2023-11-28 23:22:04 25 4
gpt4 key购买 nike

这是一个非常常见的问题,但我无法找到它的解决方案。我在 Eclipse 中创建了一个动态 Web 项目。它是一个没有 java 文件的空项目。每当我尝试在 Tomcat 服务器上运行它时,它都会给我 HTTP 状态 404 错误:找不到请求的资源。欢迎页面index.html在WEB-INF文件夹内,web.xml内容如下

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

最佳答案

index.html 应该在 Web 项目根文件夹中,在 WEB-INF 文件夹旁边。因此,在 Eclipse 中,文件夹结构应如下所示:

MyEclipseProject
...
WebContent
index.html
...
WEB-INF
web.xml

关于eclipse - 无法使用 Tomcat 启动欢迎页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42316304/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com