tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Fiol BonnĂ­n <fiol.bon...@terra.es>
Subject Re: File download impact JSP running
Date Mon, 17 Nov 2003 07:18:22 GMT
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: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message