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

java新手求助,关于servlet的404问题

xml 配置:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <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>MyServlet</servlet-name>
  <servlet-class>MyServlet</servlet-class>
  </servlet>
  <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>MyServlets</servlet-name>
  <servlet-class>MyServlets</servlet-class>
  </servlet>


  <servlet-mapping>
  <servlet-name>MyServlet</servlet-name>
  <url-pattern>/servlet/MyServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>MyServlets</servlet-name>
  <url-pattern>/servlet/MyServlets</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>
  

Tomcat也配置成功了。
下面我用http://localhost:8080/servlet/MyServlets
为什么会出现404

------解决方案--------------------
http://localhost:8080/你的项目名/servlet/MyServlets
------解决方案--------------------
下面我用http://localhost:8080/servlet/MyServlets
首先要你的项目名称,之后servlet/MyServlet
------解决方案--------------------
上面那个,怎么总是早我 一分钟,好几次了啊....