<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里面的功能呢?
<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里面的功能呢?
- <!-- 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里的内容是这个 哪个是映射?
试试
肯定讀不到
<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