[转载]jsp+java类+servlet实现文件读取、写入的功能(三)

jsp+java类+servlet实现文件读取、写入的功能(三)

本文是根据tomcat平台下实现而做,文件目录为:

tom_homewebapps ews下:

└html
└WEB-INF
└classes
└com
└FileMan.class
└FileServlet.class
└web.xml

下面开始修改web.xml令filesevelet生效/*

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">


Welcome to Tomcat

Welcome to Tomcat



org.apache.jsp.index_jsp
org.apache.jsp.index_jsp



org.apache.jsp.index_jsp
/index.jsp


FileServlet
com.FileServlet


FileServlet
/servlet/FileServlet

在浏览器中输入:http://localhost:8080/news/servlet/FileServlet

OK,出现以下面面:

同时 在newshtml下可以找到test.htm,OK,成功!
请使用浏览器的分享功能分享到微信等