好像有时候会有这种情况
不是很清楚。

解决方案 »

  1.   

    我是这么做的
    <%@ page import="java.io.*" %>
    <%@ page language="java" contentType="text/html; charset=GBK"  %>
    <%
    try{
     String path = request.getParameter("path");
     String filename = path.substring(path.lastIndexOf("\\")+1);
     filename = new String(filename.getBytes("GBK"),"ISO8859_1");
     response.setHeader("Content-disposition","attachment; filename="+filename);
     FileInputStream fis = new FileInputStream(path);
     OutputStream os = response.getOutputStream();
     int byteRead;
     while((-1) != (byteRead = fis.read())){
      os.write(byteRead);
     }
     os.close();
     if (fis != null){fis.close();}
    }catch(Exception e){
     out.print(e);
    }