【发布时间】:2011-05-08 21:50:39
【问题描述】:
我刚刚开始使用 servlet。基本上我是网络项目的新手。我正在使用 eclipse 作为开发 IDE。我创建了一个动态 Web 项目,同时我添加了一个 html 页面,即 Main.html,其中包含以下 sript:_
<!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>Main page</title>
</head>
<body>
<b>this is the first page</b>
</body>
</html>
下面是我的 web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>ServletProject</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
我使用 tomcat 6.0 作为 web 容器,仅在 eclipse 中我集成了 tomcat 并在其中添加了 web 项目。服务器正在正常启动。当我试图访问Main.html 页面时,我在浏览器上没有得到任何东西,在 tomcat 服务器配置中,有两个端口,一个是管理端口,另一个是 HTML/1.1 端口,值分别是 8005 和 8080 .当我使用http://localhost:8005/Main.html 时,我在网络浏览器中什么也得不到,但是当我使用http://localhost:8080/Main.html 时,我得到了一些 tomcat 错误。
有什么我想念的吗?我无法弄清楚。请帮帮我。
【问题讨论】:
-
能否分享一下错误代码/错误详情?
-
@Faisal : 当我使用上面提到的第二个 URL 时,我得到一些 HTTP 状态 404 错误