Java 如何在我的web项目中读取web.xml
我编写了一个基本的helloworld动态项目,其中安装了apache服务器 我的目录结构是, xml内容是Java 如何在我的web项目中读取web.xml,java,html,web-services,tomcat,dynamic,Java,Html,Web Services,Tomcat,Dynamic,我编写了一个基本的helloworld动态项目,其中安装了apache服务器 我的目录结构是, xml内容是 <display-name>hello</display-name> <welcome-file-list> <welcome-file>hello.html</welcome-file> </welcome-file-list> 你好 hello.html hello.html是 <
<display-name>hello</display-name>
<welcome-file-list>
<welcome-file>hello.html</welcome-file>
</welcome-file-list>
你好
hello.html
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状态404-/hello.html
有什么建议吗?我想你需要进入更深的目录
上面的一个应该可以工作,我想:)通常这个错误来自使用端口8080的其他应用程序,请检查同一端口上是否有其他程序。它认为您需要在url中添加项目名称:
或者仍然是相同的404错误。顺便说一句,为什么我们需要包含WebContent?您基本上需要打开每个文件夹到hello.xml目录。因为程序看不到这些文件夹中的内容,它只看到当前文件夹中的内容。您的项目目录中没有hello.xml。正确的URL应该是有帮助的。谢谢