更新时间:2021-12-28 23:46:20
默认情况下,当您以 http://localhost:8080/ProjectName/
而不是物理方式打开项目根文件夹时http://localhost:8080/ProjectName/Index.jsp
中的文件,然后服务器将在 web.xml
中查找欢迎文件.如果没有找到,那么你会得到这个 404页面未找到".错误.
By default, when you open the project root folder as in http://localhost:8080/ProjectName/
instead of a physical file as in http://localhost:8080/ProjectName/Index.jsp
, then the server will lookup for a welcome file in web.xml
. If none is found, then you'll get this 404 "Page not found" error.
就您而言,网址和文件名区分大小写.您将 index.jsp
声明为欢迎文件,但您提到您有一个 Index.jsp
.将其重命名为 index.jsp
,然后您就可以通过这种方式使用欢迎文件打开 web 应用程序的上下文根.
In your case, URLs and file names are case sensitive. You declared index.jsp
to be the welcome file, but you mentioned that you've an Index.jsp
. Rename it to index.jsp
and then you'll be able to open the webapp's context root with the welcome file this way.