• 大小: 142KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-15
  • 语言: Java
  • 标签: jsp  web  

资源简介

实现上传文件和下载等功能的jspsmartupload插件

资源截图

代码片段和文件信息

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.jspsmart.upload.*;

public class servletUpload extends HttpServlet {

private ServletConfig config;
/**
* Init the servlet
*/
final public void init(ServletConfig config) throws ServletException {
this.config = config;
}

final public ServletConfig getServletConfig() {
return config;
}
/**
* Handles GET requests
*/
public void doGet(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {

PrintWriter out = response.getWriter();
out.println(““);
out.println(““);
out.println(“

jspSmartUpload : Servlet Sample

“);
out.println(“

“);
out.println(“The method of the HTML form must be POST.“);
out.println(““);
out.println(““);
}

/**
* Handles POST requests
*/
protected void doPost(HttpServletRequest request HttpServletResponse response) throws ServletException IOException {

PrintWriter out = response.getWriter();
out.println(““);
out.println(““);
out.println(“

jspSmartUpload : Servlet Sample

“);
out.println(“
“);

// Variables
int count=0;
SmartUpload mySmartUpload = new SmartUpload();

try {
// Initialization
mySmartUpload.initialize(configrequestresponse);

// Upload
mySmartUpload.upload();

// Save the file with the original name
// in a virtual path of the web server
count = mySmartUpload.save(mySmartUpload.getRequest().getParameter(“PATH“));

// Display the result
out.println(count + “ file uploaded.“);

} catch (Exception e){
out.println(“Unable to upload the file.
“);
out.println(“Error : “ + e.toString());
}

out.println(““);
out.println(““);
          }
/**
* Destroy the servlet
*/
public void  destroy () {
}



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2008-11-24 11:16  jspsmartupload\
     文件        2837  2000-03-22 15:04  jspsmartupload\default.htm
     目录           0  2000-09-04 10:35  jspsmartupload\help\
     文件        2188  2000-05-18 16:56  jspsmartupload\help\arbo.gif
     目录           0  2000-09-04 10:35  jspsmartupload\help\doc\
     文件         985  2000-07-12 15:33  jspsmartupload\help\doc\allclasses-frame.html
     目录           0  2000-09-04 10:35  jspsmartupload\help\doc\com\
     目录           0  2000-09-04 10:35  jspsmartupload\help\doc\com\jspsmart\
     目录           0  2000-09-04 10:35  jspsmartupload\help\doc\com\jspsmart\upload\
     文件       19669  2000-07-12 15:33  jspsmartupload\help\doc\com\jspsmart\upload\File.html
     文件        9721  2000-07-12 15:33  jspsmartupload\help\doc\com\jspsmart\upload\Files.html
     文件        1234  2000-07-12 15:33  jspsmartupload\help\doc\com\jspsmart\upload\package-frame.html
     文件        5017  2000-07-12 15:33  jspsmartupload\help\doc\com\jspsmart\upload\package-summary.html
     文件        4553  2000-07-12 15:33  jspsmartupload\help\doc\com\jspsmart\upload\package-tree.html
     文件       10928  2000-07-12 15:33  jspsmartupload\help\doc\com\jspsmart\upload\Request.html
     文件       39765  2000-07-12 15:33  jspsmartupload\help\doc\com\jspsmart\upload\SmartUpload.html
     文件        6397  2000-07-12 15:33  jspsmartupload\help\doc\com\jspsmart\upload\SmartUploadException.html
     文件        5985  2000-07-12 15:33  jspsmartupload\help\doc\deprecated-list.html
     文件        6793  2000-07-12 15:33  jspsmartupload\help\doc\help-doc.html
     文件       21120  2000-07-12 15:33  jspsmartupload\help\doc\index-all.html
     文件         725  2000-07-12 15:33  jspsmartupload\help\doc\index.html
     文件        4440  2000-07-12 15:33  jspsmartupload\help\doc\overview-tree.html
     文件          21  2000-07-12 15:33  jspsmartupload\help\doc\package-list
     文件         691  2000-07-12 15:33  jspsmartupload\help\doc\packages.html
     文件        4246  2000-07-12 15:33  jspsmartupload\help\doc\serialized-form.html
     文件        1269  2000-07-12 15:33  jspsmartupload\help\doc\stylesheet.css
     文件        9046  2000-03-27 18:18  jspsmartupload\help\Errors.htm
     文件       15740  2000-05-18 09:27  jspsmartupload\help\Fileobject.htm
     文件        3677  2000-03-28 13:33  jspsmartupload\help\Filesobject.htm
     文件        7148  2000-07-12 17:59  jspsmartupload\help\jspSmartUpload-InpriseAS-En.htm
     文件        8260  2000-07-12 17:59  jspsmartupload\help\jspSmartUpload-iPlanet-En.htm
............此处省略47个文件信息

评论

共有 条评论