编译好的servlet直接把WEB-INF copy过去放在ROOT下IE访问没得问题 http://localhost:8080/servlet/hello
但是在自己的工程文件夹找不到 C:\Program Files\Apache Software Foundation\Tomcat 5.5      \webapps\projects\hello\WebRoot\WEB-INF这是WEB-INF的路径
http://localhost:8080/projects/hello/WebRoot/servlet/hello 就找不到
http://localhost:8080/projects/hello/WebRoot/index.jsp是找得到的 index.jsp是创建的时候自己生成的
不知道问题在哪里 开始以为是包的问题 没用包还是不得行 
可能我比较愚昧 但是希望大家不要笑

解决方案 »

  1.   

    应该是web.xml中hello的servlet配置有误。
    <url-pattern>/projects/hello/WebRoot/servlet/hello</url-pattern>
      

  2.   

    http://localhost:8080/projects/hello/servlet/hello ??
      

  3.   

    为什么我把WEB-INF拷过去ROOT下没得问题 ? WEB-INF里有这个XML还有classes
    试了下不得行啊。。
      

  4.   

    http://localhost:8080/工程名称/servlet/hello
      

  5.   

    projects是我在webapps下新建的一个文件夹 hello是我建的一个工程 里面那个servlet名字也叫hello
      

  6.   

    你index.jsp中是怎样调用的了?web.xml的配置内容贴出来看看。
      

  7.   

    <?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>hello</servlet-name>
        <servlet-class>hello</servlet-class>
      </servlet>  <servlet-mapping>
        <servlet-name>hello</servlet-name>
        <url-pattern>/servlet/hello</url-pattern>
      </servlet-mapping>
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
    </web-app>
    这个XML我直接是没改动的生成的 
    那个index.jsp在WebRoot文件夹下 http://localhost:8080/projects/hello/WebRoot/index.jsp
      

  8.   

    直接输入  http://localhost:8080/projects/hello 就ok了。。
      

  9.   

    上楼的朋友没有听懂我的意思我是有一个hello的工程 工程里面有个hello的servlet
    这样输入进去不得行。。
      

  10.   

    试了很多都是不行,搜了下,好像这样不行。webapps下创建的子目录中,必需有WEB_INF目录以及WEB_INF下的web.xml文件。楼主怎么会有这样的需求了?
    引用:http://www.cnblogs.com/zheng8145/archive/2009/05/02/1447829.html
      

  11.   

    http://localhost:8080/projects/hello 就ok了。。