res.setHeader("Content-Disposition","attachment;filename=" + fName);
res.setContentType("application/x-zip-compressed ");
OutputStream os = res.getOutputStream();
int byteInt = 0;
byte[] bt = new byte[1024];
while ((byteInt = zipIn.read(bt, 0, 1024)) != -1) {
os.write(bt, 0, byteInt);
os.flush();
}
if (os != null) {
os.close();
}
if (zipIn != null) {
zipIn.close();
}
文件生成后要求弹出“操作成功“对话框 alert
如何实现?

解决方案 »

  1.   

    看看LZ这结贴率真高
    ajax返回时做alert!!
      

  2.   

    不让用ajax...还有其他办法么?
      

  3.   

    response.getWriter().println("<script>alert('成功')</script>")
      

  4.   

    PrintWriter out=response.getWriter();
    out.print("<script>alert('')</script>");
      

  5.   

    OutputStream os = res.getOutputStream();
    在用response.getWriter().println("<script>alert('成功')</script>")会报错的