我的下载代码如下:
<%@ page contentType="text/html;charset=gb2312" import="com.jspsmart.upload.*,java.io.*,java.net.*" %>
<%
          int   buffsize   =   1024*2;   
          String   strFileName   =   "002.xml";   
          String   strFileURL   =   "ITService\\uploadfiles\\"+strFileName;   
          response.setContentType(   "application/none"   );   
          response.setHeader("Content-disposition","attachment;   filename="   +   strFileName   );   
          try{   
              URL     url=new   URL(strFileURL);   
              BufferedInputStream   bis   =   new   BufferedInputStream(url.openStream());   
              BufferedOutputStream   bos   =   new   BufferedOutputStream(   response.getOutputStream());   
              byte[]   buff   =   new   byte[buffsize];   
              int   bytesRead;   
              while   (-1!=(bytesRead=(bis.read(buff,0,buff.length)))){   
                  bos.write(buff,0,bytesRead);   
              }   
              if   (bis!=null){   
              bis.close();   
              }   
              if   (bos!=null){   
              bos.close();   
              }   
          }catch(IOException   ioe){   
 //             System.out.println("IOException   at   download   file!"+ioe.getMessage());   
              ioe.printStackTrace();   
          }
%>
运行后文件能下载但是Tomcat会报异常,如下:

解决方案 »

  1.   

    按有几个群,你不妨加进去,可以和大家一起讨论啊.........46986340,28039577,4804620                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
    在那里看看有无能回答你的,谢谢,LZ,甭忘了给俺分哦,谢谢LZ
      

  2.   

    http://download.csdn.net/hicsdn/privatemiao
    这里有一个文件上传组件  你可以下载看看
    这个组件可以看到源代码的。
    给你参考