最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jsp+java类+servlet实现文件读取、写入的功能(二)
时间:2022-07-02 17:58:22 编辑:袖梨 来源:一聚教程网
本文是根据tomcat平台下实现而做,文件目录为:
tom_homewebapps ews下:
└html
└WEB-INF
└classes
└com
└FileMan.class
└FileServlet.class
└web.xml
接着我们先实现servlet:FileServlet .java
/*
* FileServlet.java
*
* Created on 2005年6月19日, 下午3:03
*/
package com;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.PageContext;
/**
*
* @author 淘特网
* @version
*/
public class FileServlet extends HttpServlet {
ServletContext sc;
/** Initializes the servlet.
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
sc=config.getServletContext();
}
/** Destroys the servlet.
*/
public void destroy() {
}
/** Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
//* TODO output your page here
tom_homewebapps ews下:
└html
└WEB-INF
└classes
└com
└FileMan.class
└FileServlet.class
└web.xml
接着我们先实现servlet:FileServlet .java
/*
* FileServlet.java
*
* Created on 2005年6月19日, 下午3:03
*/
package com;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.PageContext;
/**
*
* @author 淘特网
* @version
*/
public class FileServlet extends HttpServlet {
ServletContext sc;
/** Initializes the servlet.
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
sc=config.getServletContext();
}
/** Destroys the servlet.
*/
public void destroy() {
}
/** Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
//* TODO output your page here
相关文章
- 小鸡庄园今天答案2024.10.26 11-08
- 《宝可梦大集结》宝可梦快速进化方法 11-08
- 《宝可梦大集结》qq区微信区选择推荐 11-08
- 《宝可梦大集结》信誉分快速恢复方法 11-08
- 《宝可梦大集结》排位赛快速上分方法 11-08
- 《宝可梦大集结》持有物快速升级方法 11-08