http://today.java.net/pub/a/today/2006/02/09/file-uploads-with-ajax-and-jsf.html might help.
Michael Heinen wrote: > Hi all, > > > > One of my backingBeans contains a method that returns a file for download. > > This is working fine and the standard Open/Save/Cancel box pops up. No > problem. > > > > In addition I display always a "work on progress message" with a > javascript call when my form is submitted (onSubmit). > > The problem is now that I don't know how to disable this message again > when the file is ready for download. > > There is no event on which I can react in the browser. The original page > is not reloaded (and should not be reloaded). > > > > Can I use a second jsp which calls the showOriginalDocument action and > does a javascript call in the parent window (or openener)? > > Does anybody have an idea? > > > > JSP: > > <h:commandLink action="#{MyBean.showOriginalDocument}" immediate="true"> > > <t:graphicImage url="/images/out.jpg" /> > > </h:commandLink> > > > > > > BackingBean: > > public void showOriginalDocument() { > > .. > > NativeDocument nativeDocument = > this.delegate.getOriginalDocument(this.document.getDocumentId()); > > HttpServletResponse response = > (HttpServletResponse)facesContext.getExternalContext().getResponse(); > > response.setContentType(nativeDocument.getMimeType()); > > > response.setHeader("Content-Disposition","attachment;filename=\""+ > this.document.getAttribute("docnumber")+nativeDocument.getSuffix() + "\""); > > response.setContentLength(nativeDocument.getDocument().length); > > OutputStream responseStream = > ((HttpServletResponse)facesContext.getExternalContext().getResponse()).getOutputStream(); > > responseStream.write(nativeDocument.getDocument()); > > response.flushBuffer(); > > facesContext.responseComplete(); > > > > > > Michael > -- Dave Brondsema Software Developer Cornerstone University
signature.asc
Description: OpenPGP digital signature