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="" immediate="true">

   <t:graphicImage url="" />

</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

Reply via email to