我按照网上的套路,已经运行成功了一个servlet的例子,但是再运行其他的又出错了,
不知道web.xml里应该如何写

解决方案 »

  1.   

    学会使用工具搞个JBuilder或者Eclips
    自动生成一个Servlet,然后看看web.xml怎么写的就知道了
    至少你把web.xml贴出来呀
      

  2.   

    第一个例子的web.xml
    <!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>  
      <display-name>My   Web   Application</display-name>  
      <description>  
      A   application   for   test.  
      </description>
        
      <servlet>  
      <servlet-name>HTTPGetServlet</servlet-name>  
      <servlet-class>HTTPGetServlet</servlet-class>  
      </servlet>  
      <servlet-mapping>  
      <servlet-name>HTTPGetServlet</servlet-name>  
      <url-pattern>/HTTPGetServlet</url-pattern>  
      </servlet-mapping>  
      </web-app>
    这个运行成功了,我把另外一个.class放在相同文件夹下,但是不知道应该怎么写web.xml
      

  3.   

    .class 存放的目录:...Tomcat 5.5\webapps\myapp\WEB-INF\classes
      

  4.   

    我将另外一个.class拷贝到Tomcat 5.5\webapps\myapp\WEB-INF\classes下,并且把web.xml中的servlet名都改了,但是出错:
    HTTP Status 405 - HTTP method GET is not supported by this URLtype Status reportmessage HTTP method GET is not supported by this URLdescription The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).
    Apache Tomcat/5.5.17谁能指点一下啊,谢谢