Hello,
I know nothing about Content-Disposition. In fact, the only thing I know
is that we never needed/used it ;-)
Maybe it is too obvious, but I suggest you to try
"response.setContentType()" instead.
Anyway, I will try to get a code snippet from one of our apps a bit
later for you.
Hope that helps a little bit.
Antonio Fiol
Cui Xiaojing-a13339 wrote:
>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]
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]