在tomcat的webapp目錄下是全部的項目,經過http://localhost:8080/項目名/ 能夠直接訪問這個項目的默認頁面web
要使用某一個servlet 地址是這樣的http://localhost:8080/項目名/servlet/servlet名稱tomcat
http://localhost:8080/Myservice/servlet/Myserviceapp
正確配置sevletwebapp
<servlet> <description>This is the description of my J2EE component</description> <display-name>This is the display name of my J2EE component</display-name> <servlet-name>Myservice</servlet-name> <servlet-class>Myservice</servlet-class> </servlet> <servlet-mapping> <servlet-name>Myservice</servlet-name> <url-pattern>/servlet/Myservice</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list>