我的servlet的名字是HelloWorld
将.class文件放到...\ROOT\WEB-INF\classes 里
也设置了web.xml:
<servlet-mapping>
  <servlet-name>invoker</servlet-name>
  <url-pattern>/servlet/HelloWorld</url-pattern>
</servlet-mapping>浏览器http://localhost:1776/servlet/HelloWorld
里显示resource not avavilble
到底哪里错了呢?

解决方案 »

  1.   

    <servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>HelloWorld</servlet-class>

        </servlet>这个设没
      

  2.   

    不行啊
    把你的也放里面了
    连tom-cat都启动不了啦
      

  3.   

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!--
      Copyright 2004 The Apache Software Foundation  Licensed 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/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">  <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description>
    <!-- JSPC servlet mappings start -->

    <servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>HelloWorld</servlet-class>
    </servlet> <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/HelloWorld</url-pattern>
    </servlet-mapping><!-- JSPC servlet mappings end --></web-app>
      

  4.   

    不好意思上面的是我的小弟弟给我捣乱
    我本来就没看这条,我去WC了回来就看见了上面的
    我小弟弟说要交管理员删除我的id好叫我不上csnd了
    而是和他玩
      

  5.   

    怎么会压 你用的是什么的IDE呀
    一般来说web。xml 是不用你来写的亚?
    他是可以自主声称的亚
    你的工程大麻 如果不打得花 你就在建立一个
    在把你的代码放到新的工程里去 
    你是是web。xml 应该是一个新的了
      

  6.   

    晕了 还是不行呀
    访问主页都不行了 错误:
    type Status reportmessage No Context configured to process this requestdescription The server encountered an internal error (No Context configured to process this request) that prevented it from fulfilling this request.我的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>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description><!-- JSPC servlet mappings start --><servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>HelloWorld</servlet-class>
    </servlet><servlet-mapping>
      <servlet-name>invoker</servlet-name>
      <url-pattern>/servlet/HelloWorld</url-pattern>
    </servlet-mapping><!-- JSPC servlet mappings end --></web-app>
      

  7.   

    你们的tomcat的设置都哪里该了?
    除了:
      /conf/server.xml里的port
      /webapps/ROOT/WEB-INF/web.xml里添加mapping还有哪里呀?
      

  8.   

    1:你的类的package是什么,在classes中要按正确的目录结构存放class文件;2:在web.xml中要按顺序书写<servlet>和<servlet-mapping>3:servlet-class中要写清类路径4:注意大小写
      

  9.   

    终于搞定了 不知道是我的机器有问题还是....应该把两个invoker直接换成类名
    再在server.xml里改一下comtext里的path="/ROOT" docBase="ROOT"(或自己的文件路径)唉~ 真实让人失望
    这么个小问题折腾我一晚上