This problem not only for Jasper reports, in normal crud application, if
I open the pdf or excel its opening new window the application browser
is blank.

-----Original Message-----
From: Trent [mailto:[EMAIL PROTECTED] 
Sent: 07 August 2007 09:13 AM
To: [email protected]
Subject: RE: [appfuse-user] how to redirect the page.

On Tue, 7 Aug 2007 08:27:12 +0200, Srini Bobbala wrote
> Thanks matt,
> We are using IE & and fire fox, its opening the PDF as a separate
window
> (not a browser).
> How can we force to open in same window with a back button?

Try altering the content-disposition of the page or servlet that sends
the PDF. 

The app I'm currently working on can send files in a new window, or
inside an
iframe (and thus, inside the page). To achieve that, the servlet that
generates the file has this method:

private void write(HttpServletResponse response, String reportMimeType,
byte[]
content, boolean inline) {
        response.reset(); // required by IE for some reason
        response.setContentType(reportMimeType);
        response.setContentLength(content.length);
        String disposition = inline? "inline" : "attachment";
        if (PDF_MIME_TYPE.equals(reportMimeType)) {
            response.setHeader("Content-Disposition", disposition+
";filename=report.pdf");
        }
        if (RTF_MIME_TYPE.equals(reportMimeType)) {
            response.setHeader("Content-Disposition", disposition +
";filename=report.rtf");
        }
        try {
            response.getOutputStream().write(content);
        } catch (IOException ex) {
            LOG.error("write()", ex);
        }
    }

It's not fully factored but it illustrates the technique.

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

Reply via email to