如何在我的Web项目中读取web.xml

时间:2022-12-16 13:16:22

I wrote a basic Hello World we dynamic project with the apache server installed with it.

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

My directory structure is, 如何在我的Web项目中读取web.xml

我的目录结构是,

Web.xml content is,

Web.xml内容是,

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

  </welcome-file-list>

hello.html is,

<!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>

After starting my apache, I'm trying to access the URL,
http://localhost:8080/hello.html
Getting error as : HTTP Status 404 - /hello.html
Any suggestion?

启动我的apache后,我正在尝试访问URL,http:// localhost:8080 / hello.html获取错误为:HTTP状态404 - /hello.html有任何建议吗?

3 个解决方案

#1


2  

It think you need to add the name of your project in the url:

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

http://localhost:8080/ProjectName/

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

#2


0  

Usually this error is from other applications using the port 8080, check if any program else on same port.

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

#3


0  

I would say you need to into a deeper directory.

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

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

The above one should work I think :)

以上应该工作我认为:)

#1


2  

It think you need to add the name of your project in the url:

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

http://localhost:8080/ProjectName/

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

#2


0  

Usually this error is from other applications using the port 8080, check if any program else on same port.

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

#3


0  

I would say you need to into a deeper directory.

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

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

The above one should work I think :)

以上应该工作我认为:)