package com.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.jspsmart.upload.SmartUpload; import com.jspsmart.upload.SmartUploadException; public class DownloadServlet extends HttpServlet { /** * Constructor of the object. */ public DownloadServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String fileName=new String(request.getParameter("file").getBytes("ISO-8859-1"),"GBK"); System.out.println(fileName); SmartUpload su=new SmartUpload(); su.initialize(this.getServletConfig(),request,response); su.setContentDisposition(null); try { su.downloadFile("/upfile/"+fileName); } catch (SmartUploadException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occure */ public void init() throws ServletException { // Put your code here } }

jameshkj LV8
2023年5月18日
lironggang LV38
2022年11月20日
15185836794 LV2
2021年11月8日
chenynhz LV2
2021年9月16日
1126055836 LV15
2021年8月20日
isMrQt LV1
2021年7月15日
15630419308 LV2
2021年5月16日
keeeww LV1
2020年11月20日
小仙女本仙haha LV8
2020年6月20日
lyd19931203 LV21
2020年6月16日