日期:2014-05-17  浏览次数:20606 次

菜鸟级求助:Servlet部署文件应该怎么弄啊?
我初学,照着书上的Servlet做了个HelloWorld的例子:
  用的是Eclipse,tomcat可以正常运行
  以下是部署文件的代码:
<?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd ">
<web-app>
  <Servlet>
  <servlet-name>HelloWorld</servlet-name>
  <servlet-class>test.HelloWorld</servlet-class>
  </Servlet>

  <servlet-mapping>
  <servlet-name>HelloWorld</servlet-name>
  <url-pattern>/test.HelloWorld</url-pattern>
  </servlet-mapping>

  <session-config>
  <session-timeout>30</session-timeout>
  </session-config>
</web-app>
以下是文件结构:
C:\Documents and Settings\Administrator\workspace\TestTomcat\WEB-INF\src\test
里面是HelloWorld.java

C:\Documents and Settings\Administrator\workspace\TestTomcat\WEB-INF
这里放的web.xml

运行:http://localhost:8080/TestTomcat/test/HelloWorld
HTTP Status 404 - /TestTomcat/test/HelloWorld

--------------------------------------------

type Status report

message /TestTomcat/test/HelloWorld

description The requested resource (/TestTomcat/test/HelloWorld) is not available.


--------------------------------------------

Apache Tomcat/6.0.29
请问是怎么回事啊?多谢多谢了

------解决方案--------------------
探讨
C:\Documents and Settings\Administrator\workspace\TestTomcat\WEB-INF\src\test
里面是 HelloWorld.java

运行:http://localhost:8080/TestTomcat/test/HelloWorld