404设置Eclipse Dynamic Web Application时

Ada*_*mes 1 java eclipse http-status-code-404 tomcat7

这是我第一次尝试自己设置一个Web应用程序项目,由于某种原因,我甚至无法使用hello world设置.我将所有内容设置为默认值,选择用于编译的JDK1.8和带有仅包含文本的index.html页面的Tomcat7服务器.在将项目添加到服务器之后,我应该可以右键单击项目并在服务器上运行,但即使使用这个简单的设置,我仍然可以获得404.我错过了什么?

建立

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>
Run Code Online (Sandbox Code Playgroud)

wit*_*arn 7

您无法直接访问WEB-INF文件夹下的文件.Container将在WEB-INF/classes中查找类,而WEB-INF下的jsp文件可以包含在其他JSP中,但任何请求资源的浏览器都会得到404响应.

您应该改变的index.xhtml路径webapp/WEB-INF/index.html,以webapp/index.html对应于你的web.xml