String down_filename="123.xls";
down_filename=new String(down_filename.getBytes("gb2312"),"ISO-8859-1");
//String path="/usr/home/zhanghui/yian/yian/dl";
String path=request.getRealPath("");
try {
sql = DoFile.getListByParam(startDate, endDate, type);
System.out.println("sql1111111111------"+sql);
pexecl.writeExcel(sql,path+"123.xls");

} catch (Exception e1) {
e1.printStackTrace();
}
System.out.println(path);
    File file = new File(down_filename);
    // 取得文件名。
    String filename = file.getName();
    // 取得文件的后缀名。
    //String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase(); response.setHeader("Content-disposition","attachment;filename="+down_filename);  //随意选择下载路径
System.out.println("newFileName:" + filename);
    
    
OutputStream output = null; 
FileInputStream fis = null; 
     try 
     { 
         output   = response.getOutputStream(); 
         fis = new FileInputStream(path+"/"+down_filename); 
         byte[] b = new byte[1024];
         int i1 = 0; 
        
         while((i1 = fis.read(b)) !=-1) 
         { 
     output.write(b, 0, i1); 
         } 
         output.flush(); 
     } 
     catch(Exception e) 
     { 
         System.out.println("out Error!"); 
         e.printStackTrace(); 
     } 
     finally 
     { 
         if(fis != null) 
         { 
             fis.close(); 
             fis = null; 
         } 
         if(output != null) 
         { 
             output.close(); 
             output = null; 
         } 
     }