• 大小: 8KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-01-04
  • 语言: 其他
  • 标签: servlet  

资源简介

使用Servlet实现文件的上传与下载Demo

资源截图

代码片段和文件信息

package com.cc.uploaddownload;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;

@MultipartConfig
public class UploadDownloadServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest req HttpServletResponse resp) throws ServletException IOException {
// TODO Auto-generated method stub
doPost(req resp);
}

@Override
protected void doPost(HttpServletReques

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        841  2017-02-13 19:10  DownLoadUpLoad\.classpath

     文件        914  2017-02-13 19:10  DownLoadUpLoad\.project

     文件        567  2017-02-13 19:10  DownLoadUpLoad\.settings\.jsdtscope

     文件        364  2017-02-13 19:10  DownLoadUpLoad\.settings\org.eclipse.jdt.core.prefs

     文件        494  2017-02-13 19:10  DownLoadUpLoad\.settings\org.eclipse.wst.common.component

     文件        345  2017-02-13 19:10  DownLoadUpLoad\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2017-02-13 19:10  DownLoadUpLoad\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2017-02-13 19:10  DownLoadUpLoad\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       4126  2017-02-13 20:17  DownLoadUpLoad\build\classes\com\cc\uploaddownload\UploadDownloadServlet.class

     文件       3623  2017-02-13 20:17  DownLoadUpLoad\src\com\cc\uploaddownload\UploadDownloadServlet.java

     文件         39  2017-02-13 19:10  DownLoadUpLoad\WebContent\meta-INF\MANIFEST.MF

     文件        748  2017-02-13 20:18  DownLoadUpLoad\WebContent\updown.jsp

     文件        974  2017-02-13 19:19  DownLoadUpLoad\WebContent\WEB-INF\web.xml

     目录          0  2017-02-13 19:12  DownLoadUpLoad\build\classes\com\cc\uploaddownload

     目录          0  2017-02-13 19:12  DownLoadUpLoad\build\classes\com\cc

     目录          0  2017-02-13 19:12  DownLoadUpLoad\src\com\cc\uploaddownload

     目录          0  2017-02-13 19:12  DownLoadUpLoad\build\classes\com

     目录          0  2017-02-13 19:12  DownLoadUpLoad\src\com\cc

     目录          0  2017-02-13 19:10  DownLoadUpLoad\WebContent\WEB-INF\lib

     目录          0  2017-02-13 19:12  DownLoadUpLoad\build\classes

     目录          0  2017-02-13 19:12  DownLoadUpLoad\src\com

     目录          0  2017-02-13 19:10  DownLoadUpLoad\WebContent\meta-INF

     目录          0  2017-02-13 19:21  DownLoadUpLoad\WebContent\WEB-INF

     目录          0  2017-02-13 19:10  DownLoadUpLoad\.settings

     目录          0  2017-02-13 19:10  DownLoadUpLoad\build

     目录          0  2017-02-13 19:12  DownLoadUpLoad\src

     目录          0  2017-02-13 20:08  DownLoadUpLoad\WebContent

     目录          0  2017-02-13 19:10  DownLoadUpLoad

----------- ---------  ---------- -----  ----

                13090                    28

............此处省略1个文件信息

评论

共有 条评论