HTTP状态404 - 请求的资源(/ ProjectName /)不可用 [英] HTTP Status 404 - The requested resource (/ProjectName/) is not available
问题描述
HTTP状态404 - 请求的资源(/ ProjectName /)不可用。
浏览器地址栏中的URL为 http:// localhost:8080 /项目名/
。
我真的不知道我的文件丢失什么。我在 / WebContent
文件夹中的 Index.jsp
和我的 web.xml
包含以下条目:
< welcome-file-list>
< welcome-file> index.jsp< / welcome-file>
< / welcome-file-list>
默认情况下,当您打开项目根文件夹在 http:// localhost:8080 / ProjectName /
中,而不是在 http:// localhost:8080 / ProjectName / Index.jsp中的物理文件
,则服务器将在 web.xml
中查找欢迎文件。如果没有找到,那么你会得到这个404页面未找到错误。
在你的情况下,URL和文件名是区分大小写< STRONG>。您声明了 index.jsp
作为欢迎文件,但您提到您有一个 Index.jsp
。将其重命名为 index.jsp
,然后您可以使用欢迎文件打开webapp的上下文根目录。
另见:
- 如何在web.xml中配置欢迎文件列表
- 使用doGet更改servlet的根路径中的默认主页
- 通过< welcome设置默认主页-file>在JSF项目中
I'm getting the following error when running my Eclipse project on Tomcat server:
HTTP Status 404 - The requested resource (/ProjectName/) is not available.
The URL in browser's address bar is http://localhost:8080/ProjectName/
.
I really don't know what is missing in my files. I have an Index.jsp
in the /WebContent
folder and my web.xml
contains below entry:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
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.
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.
See also:
- How to configure welcome file list in web.xml
- Change default homepage in root path to servlet with doGet
- Set default home page via <welcome-file> in JSF project
这篇关于HTTP状态404 - 请求的资源(/ ProjectName /)不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!