<HTML>
<HEAD>
  <TITLE>第一个JSP页面</TITLE>
</HEAD>
<BODY>
<H3>请在下面输入信息:</H3>
<FORM ACTION="servlet/chapter1.dealInfoServlet" METHOD="POST">
信息输入:<input type="text" name="info" size = "30">
<INPUT TYPE="submit" NAME="submit" VALUE="提交">
</FORM>
</BODY>这是HTML文件的内容
运行后点击提交按钮会出现
HTTP Status 404 - /chapter1/servlet/chapter1.dealInfoServlet--------------------------------------------------------------------------------type Status reportmessage /chapter1/servlet/chapter1.dealInfoServletdescription The requested resource (/chapter1/servlet/chapter1.dealInfoServlet) is not available.我用的是Tomcat 
HTML文件在D:\Tomcat 5.5\webapps\ROOT\chapter1下
此文件夹下还有dealInfoServlet.java  dealInfoServlet.class  showInfo.jsp  unKnownInfo.jsp
WEB-INF的classes中我放了文件夹chapter1 里面有dealInfoServlet.java  dealInfoServlet.class 请问这些文件放置的位置对吗?如何才能成功调用dealInfoServlet.java里面的功能呢?

解决方案 »

  1.   

    servlet/chapter1/dealInfoServlet你web.xml里面关于dealInfoServlet的映射<url-pattern>是什么,就写什么
      

  2.   

    不懂。。能具体点吗??哪个文件夹里面的web.xml?
      

  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>org.apache.jsp.index_jsp</servlet-name> 
      <servlet-class>org.apache.jsp.index_jsp</servlet-class> 
      </servlet>
    - <servlet-mapping>
      <servlet-name>org.apache.jsp.index_jsp</servlet-name> 
      <url-pattern>/index.jsp</url-pattern> 
      </servlet-mapping>
    - <!--  JSPC servlet mappings end 
      --> 
      </web-app>这个web.xml里的内容是这个 哪个是映射?
      

  4.   

    我看了看别的例子  我的这个web.xml好像不是我这个的  这个web.xml是自动生成的?还是?
      

  5.   

    <FORM ACTION="servlet/chapter1/dealInfoServlet" METHOD="POST">
    试试
      

  6.   

    我的媽。你用ECLIPSE 或者 JBUILDER 搞個工程來再說吧 你都不是用IDE寫的。。 文件位置都亂放
    肯定讀不到
      

  7.   

    <servlet>
      <servlet-name>servlet</servlet-name>  
      <servlet-class>Servlet类</servlet-class>  
      </servlet>
     <servlet-mapping>
      <servlet-name>servlet</servlet-name>  
      <url-pattern>/servletPath</url-pattern>  
      </servlet-mapping>
    访问路径就是servletPath