tomcat要想运行要jdk但如果tomcat能运行,说明jdk装好了。
故只要能运行jsp就能运行servlet

解决方案 »

  1.   

    tomcat可以正常运行,说明配置文件没错。但运行servlet时就出错。
    好像要装jswdk,但www.sun.com上没有下载程序,请问还有什么地方可以下载?
      

  2.   

    不需要jswdk,但必须安装jsdk,还要配置虚拟目录下的WEB-INF/web.xml文件。
      

  3.   

    我都配好了,tomcat也能正常启动,但运行最简单的servlet也出现错误
    The requested resource (/test/helloworld) is not available.server.xml
    <Context path="/test" docBase="F:\example\webapp" reloadable="true" debug="0" />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>The first Web Application</display-name>
      <description>
        to test the servlet initialization process
      </description>  <servlet>
        <servlet-name>helloworld</servlet-name>
        <display-name>HelloWorld</display-name>
        <servlet-class>
          myservlets.HelloWorld
        </servlet-class>
      </servlet>  <servlet-mapping>
        <servlet-name>helloworld</servlet-name>
        <url-pattern>/helloworld</url-pattern>
      </servlet-mapping></web-app>