日期:2014-05-18  浏览次数:20672 次

servlet 问题
先说一下自己的配置啊!!!
C:\Program   Files\Apache   Software   Foundation\Tomcat   6.0\conf\Catalina\localhost   目录下配置webApp.xml       内容为 <Context   path= "/webApp "   docBase= "F:\webApp "   reloadable= "true ">
</Context>
在F:\webApp目录下建有src   ,WEB-INF目录   WEB-INF目录下有classes目录和web.xml文件web.xml内容为
<?xml   version= "1.0 "   encoding= "gb2312 "?>
<!--
  Licensed   to   the   Apache   Software   Foundation   (ASF)   under   one   or   more
    contributor   license   agreements.     See   the   NOTICE   file   distributed   with
    this   work   for   additional   information   regarding   copyright   ownership.
    The   ASF   licenses   this   file   to   You   under   the   Apache   License,   Version   2.0
    (the   "License ");   you   may   not   use   this   file   except   in   compliance   with
    the   License.     You   may   obtain   a   copy   of   the   License   at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless   required   by   applicable   law   or   agreed   to   in   writing,   software
    distributed   under   the   License   is   distributed   on   an   "AS   IS "   BASIS,
    WITHOUT   WARRANTIES   OR   CONDITIONS   OF   ANY   KIND,   either   express   or   implied.
    See   the   License   for   the   specific   language   governing   permissions   and
    limitations   under   the   License.
-->

<web-app   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 "
      version= "2.5 ">

    <display-name> Welcome   to   Tomcat </display-name>
    <description>
          Welcome   to   Tomcat
    </description>
<servlet>
<servlet-name> CreateDBServlet </servlet-name>
<servlet-class> CreateDBServlet </servlet-class>
<init-param>
<param-name> driverClass </param-name>
<param-value> com.mysql.jdbc.Driver </param-value>
</init-param>
<init-param>
<param-name> urll </param-name>
<param-value> jdbc:mysql://localhost:3306/mysql </param-value>
</init-param>
<init-param>
<param-name> user </param-name>
<param-value> root </param-value>
</init-param>
<init-param>
<param-name> password </param-name>
<param-value> 472958355 </param-value>
</init-param>
</servlet>