【问题标题】:How to see the web.xml is read in my Web project如何查看我的 Web 项目中读取的 web.xml
【发布时间】:2017-02-08 12:22:42
【问题描述】:

我编写了一个基本的 Hello World we 动态项目,并安装了 apache 服务器。

我的目录结构是,

Web.xml 内容是,

  <display-name>hello</display-name>
  <welcome-file-list>
    <welcome-file>hello.html</welcome-file>

  </welcome-file-list>

hello.html 是,

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Hello World!!
</body>
</html>

启动我的 apache 后,我正在尝试访问 URL,
http://localhost:8080/hello.html
得到错误:HTTP Status 404 - /hello.html
有什么建议吗?

【问题讨论】:

标签: java html web-services tomcat dynamic


【解决方案1】:

它认为你需要在 url 中添加你的项目名称:

http://localhost:8080/ProjectName/

http://localhost:8080/ProjectName/hello.html

【讨论】:

  • 这有帮助。谢谢!
【解决方案2】:

此错误通常来自使用端口 8080 的其他应用程序,请检查同一端口上是否有其他程序。

【讨论】:

    【解决方案3】:

    我会说你需要进入更深的目录。

    http://localhost:8080/WebContent/hello.html

    我认为上面的应该可以工作:)

    【讨论】:

    • 还是一样的 404 错误。顺便说一句,为什么我们需要包含 WebContent?
    • 你基本上需要打开每个文件夹,直到 hello.xml 目录。
    • 因为程序无法查看这些文件夹中的内容,所以只能查看当前文件夹中的内容。
    猜你喜欢
    • 1970-01-01
    • 2011-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多