Hello All,
I use below a set of commands to download a file, after the file is saved into local
disk, the current JSP page (Jreport_main.jsp) could not work correctly. After the
current page is refreshed, it can work again. Does setting header in response impact
the jsp running? Could please give some advice? Thanks.
FileDAO fd=new FileDAO();
response.setHeader("Cache-Control", "no-cache");
File f=new File("e:/report.xls");
response.addHeader("Content-disposition", "attachment; filename="
+f.getName());
ServletOutputStream out = response.getOutputStream();
FileInputStream in=new FileInputStream(f);
int b;
while ((b=in.read())!=-1){
out.write(b);
}
in.close();
out.close();
RequestDispatcher rd =
getServletContext().getRequestDispatcher("/Jreport_main.jsp");
rd.forward(request, response);
Regards,
Xiaojing
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]