看抱错信息:java.lang.NoClassDefFoundError
没有找到classes:com/jspdev/ch5/SimpleCalculator!
把这个class文件放到ch5/web-inf/classes里面!

解决方案 »

  1.   

    兄弟,不能这么搞的
    建了ch5后还要再建几个目录,结构如下:
    ch5\ servlets\SimpleCalculator.jsp
       \ WEB-INF\classes\SimpleCalculator.class
                \web.xml
    其中web.xml更改后要restart Tomcat
    ----------
    <!--web.xml文件的内容 -->
    <!DOCTYPE web-app PUBLIC 
           "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" 
           "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
            <web-app>
       
         <!-- General description of your Web application -->
          <display-name>
             test
       </display-name>
      
         <description>
            test
          </description>
       
          <!-- Servlet definitions -->
          <servlet>
            <servlet-name>test</servlet-name>
      
            <description>
              test
             </description>
       
             <servlet-class>
             SimpleCalculator
           </servlet-class>
        </servlet>
          <!-- Servlet mappings -->
         <servlet-mapping>
            <servlet-name>test</servlet-name>
            <url-pattern>/test</url-pattern>
         </servlet-mapping>
     
      </web-app>在IE中输入
    localhost:8080/ch5/servlet/SimpleCalculator.jsp
    试试,应该可以的;
      

  2.   

    和我的错误多阿
    HTTP Status 404
    http://community.csdn.net/Expert/topic/3469/3469373.xml?temp=.2387659
      

  3.   

    把你ROOT目录中的WEB-INF这个目录拷贝到你的ch5目录下,就可以了
      

  4.   

    有 WEB-INF 吗?就是 ROOT 下的那个文件,你只要直接拷贝过来就成了 !
      

  5.   

    ytfei(飞):web.xml中要自已写吗?
    我没有学过xml。
      

  6.   

    那也就是说,任何一个目录下要编译jsp文件就一定要有WEB-INF 和web.xml才行是吗?那web.xml具体里面写的代码是什么意思!!
      

  7.   

    修改tomcat_home/conf/server.xml:
    在<host></host>之间写入:
    <context path="yourpath" docBase="yourDoc" debug="0"/>
    这样就行了。
      

  8.   

    对了,修改过后需要重新启动tomcat
      

  9.   

    jerrykey(钥匙)那样加进去会不会把它原本默认的改了呢?