我刚开始使用servlet。基本上我对网络项目很陌生。我使用eclipse作为开发IDE。在我创建一个动态Web项目,在同我增加了一个HTML页面即main.html中有以下sript:_使用servlet和web项目时使用java的问题
<!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
我没有得到任何一个Web浏览器,但是当我使用http://localhost:8080/Main.html
我得到一些tomcat错误。
有什么我失踪了。我无法弄清楚。请帮帮我。
你能分享错误代码/错误的细节吗? – 2010-11-12 06:29:13
@Faisal:当我使用上面提到的第二个URL时,我得到了一些HTTP状态404错误 – 2010-11-12 06:54:36