首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

下载exceL被IE阻止了。如何解决啊

2013-12-28 
下载exceL被IE阻止了。怎么解决啊?大致的前后我贴下代码,大家指导一下$.ajax({url:./login.wf?sid+sid+

下载exceL被IE阻止了。怎么解决啊?
大致的前后我贴下代码,大家指导一下
$.ajax({
url:"./login.wf?sid="+sid+"&cmd=Ghs_To_Download&leimuid="+leimuId,
data:{leimuid:leimuId},
success:function(response,options){   
 window.location.href ="../receive_upload.type=download";
}
}
});
我url的请求的是动态生成excel,window.location.href到了jsp页面,jsp上面处理的下载

response.reset();
        response.setContentType("APPLICATION/OCTET-STREAM");
        filePath = response.encodeURL(new String(filePath.getBytes(),
                "ISO8859_1"));
        response.setHeader("Content-Disposition", "attachment; filename=""
                + filePath + """);
        response.setContentType("application/octet-stream;"); 
        OutputStream outs = response.getOutputStream();
        InputStream inStream = new FileInputStream(filePath);
        byte[] b = new byte[1024];
        int len;
        while ((len = inStream.read(b)) > 0)
            outs.write(b, 0, len);
        response.setStatus(response.SC_OK);
        response.flushBuffer();
        outs.close();
        outs.flush();
        inStream.close();  

但是下载总是被IE阻止,要点IE的下载文件,刷新一次页面后才能下载 
[解决办法]
用window.open()来打开下载的页面

热点排行