servlet要在web.xml里配置才能使用

解决方案 »

  1.   

    恩,谢谢!我看了网上的,好像也是的,每个serlet都要配置吗?
      

  2.   

    麻烦你在看一下,我还是没搞出来.你帮我看看是哪里的问题.
    Servlet文件是:C:\Tomcat\webapps\myapp\WEB-INF\classes\test\FormGetException.class
    html文件放在:C:\Tomcat\webapps\myapp\WEB-INF\FormGetException.html
    我现在配置的web.xml文件为:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!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>FormGetExample</servlet-name>
    <display-name>FormGetExample</display-name>
    <description>A test Servlet</description>
    <servlet-class>test.FormGetExample</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>FormGetExample</servlet-name>
    <url-pattern>/FormGetExample</url-pattern>
    </servlet-mapping>
    </web-app>
      

  3.   

    上面单词打错了,都是FormGetExample,我现在都不是很理解,就是一边看书一边试一试.