我的平台是在Ubuntu 9.04,我安裝了tomcat6.
我的 file structure:
ROOT
-myapp
-index.html
-WEB-INF
--webxml
--classes
---WelcomeServlet.class
我的web.xml
<web-app 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">
<servlet>
<servlet-name>WelcomeServlet</servlet-name>
<servlet-class>WelcomeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WelcomeServlet</servlet-name>
<url-pattern>/WelcomeServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html </welcome-file>
</welcome-file-list>
</web-app>
最後我在myapp目錄底下,用jar cvf myapp.war *
我在把myapp.war移到ROOT目錄底下。
但是在我打開http://localhost:8080/myapp/,它找不到。
這是為什麼呢?