I call this method out of a commandlink via method binding. I don't use a servlet, but a action method inside a backing bean.
-----Ursprüngliche Nachricht----- Von: Carsten Burghardt [mailto:[EMAIL PROTECTED] Gesendet: Samstag, 20. August 2005 15:18 An: MyFaces Discussion Betreff: Re: AW: Download file with jsf Am Saturday 20 August 2005 13:07 schrieb Tim Peteler: > Further information on: > http://www.onjava.com/pub/a/onjava/excerpt/java_cookbook_ch18/?page=6 Thanks, my servlet looks similar ;-) > I solved this problem this way: > > public void exportFile() { > FacesContext context = FacesContext.getCurrentInstance(); > HttpServletResponse response = > (HttpServletResponse)context.getExternalContext().getResponse(); > response.setContentType("application/pdf"); > response.setHeader("Content-disposition", > "inline=filename=file.pdf"); > > try { > response.getOutputStream().write(yourdata[]); > response.getOutputStream().flush(); > response.getOutputStream().close(); > context.responseComplete(); And that works? How do you call this method? My first try looked exactly like this but I had the very exact problem that I described: every further click of the user worked only the second time. Carsten -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.13/78 - Release Date: 19.08.2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.13/78 - Release Date: 19.08.2005

