日期:2014-05-18  浏览次数:20657 次

使用jspsmartuploader下载出现问题
package   myjob.web;

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

public   class   doDownload   extends   HttpServlet   {
        private   static   final   String   CONTENT_TYPE   =   "text/html;   charset=GBK ";
        private   ServletConfig   config;
        //Initialize   global   variables
        public   void   init()   throws   ServletException   {
                this.config   =   config;
        }
        final   public   ServletConfig   getServletConfig(){
                return   config;
        }
        //Process   the   HTTP   Get   request
        public   void   doGet(HttpServletRequest   request,   HttpServletResponse   response)   throws
                        ServletException,   IOException   {

                response.setContentType(CONTENT_TYPE);
                String   downfile   =   null;

                try{
                        downfile   =   "d:\\tmp\\a.txt ";
                        if   (downfile!=null)
                            downloadfile(request,   response,   downfile);
                }catch(Exception   e){
                    PrintWriter   out   =   response.getWriter();
                    out.print( "downfile   error. ");
                    String   err=e.getMessage();
                    out.print(err);
                }
        }
        //Process   the   HTTP   Post   request
          public   void   doPost(HttpServletRequest   request,   HttpServletResponse   response)   throws   ServletException,   IOException   {
              doGet(request,   response);
    }
        //Clean   up   resources
        public   void   destroy()   {
        }
        private   void   downloadfile(HttpServ