方法可以不报错走完,但是不弹下载提示保存框,代码如下,跪求帮助public void downLoad() throws Exception {
        String filePath = request.getParameter("filePath");
       // File f = new File(filePath);
        File f = new File(new String(filePath.getBytes("ISO8859-1"),"utf-8"));
        BufferedInputStream br = new BufferedInputStream(new FileInputStream(f));
        byte[] buf = new byte[1024];
        int len = 0;
        response.reset();
        response.setContentType("application/octet-stream");
        response.setHeader("Content-Disposition", "attachment; filename="
                + toUTF8(f.getName()));
        OutputStream out = response.getOutputStream();
        while ((len = br.read(buf)) > 0)
            out.write(buf, 0, len);
        out.flush();
        br.close();
        out.close();
        logger.info("下载结束");

解决方案 »

  1.   

    logger.info("下载结束");
    这玩意应该是输出到日志中去了吧,怎么会弹框呢
      

  2.   

    你前台不能用ajax请求  用普通的表单就可以了
      

  3.   

    不要用Ajax提交,尼玛搞了半天!
      

  4.   

    真是气死人了,真不让ajax 搞啊,浪费好几个小时。
      

  5.   

    attachment这个就是弹出保存的值。代码没错 。浏览器有设置 弹出框的。设置下浏览器。
      

  6.   

    下载那个弹框是浏览器的吧,log.info是本地控制台打印信息的撒
      

  7.   

    这根后台代码没关系,我遇到过,有些特定版本的firefox无法弹窗,但是前端换个写法可以解决