Hi everybody,

 

Maybe my question is a little bit off topic because I think it is not directly a jsf problem.

But perhaps somebody has an idea.

 

Depending on attributes in my backingBean I have to start different plugins in the browser or serve some content as plain html.

 

Now I am fighting with an Iframe and I am going mad with a simple prototype

I just want to display some files (pdf and others) inline in an iframe.

 

My master page contains:

<f:verbatim>

   <iframe id="bla1" src="">

<f:verbatim>

 

 

page1.jsp just writes the pdf to the response:

<%

byte[] pdfContent = Dummy.getDummyPDF();

javax.servlet.http.HttpServletResponse myresponse = (javax.servlet.http.HttpServletResponse) javax.faces.context.FacesContext.getCurrentInstance().getExternalContext().getResponse();

myresponse.setContentType("text/pdf"); //tried also application/pdf

myresponse.setHeader("Content-Disposition","Inline; filename=\"test.pdf\"");

myresponse.setContentLength(pdfContent.length);

java.io.OutputStream responseStream = myresponse.getOutputStream();

responseStream.write(pdfContent);

myresponse.flushBuffer();

responseStream.close();

//javax.faces.context.FacesContext.getCurrentInstance().responseComplete();

%>

 

The problem is, that the pdf is always opened in an external window. The inline header is ignored!!!

I tried also to use a servlet (as mentioned in the WIKI) with the same result.

 

Finally I mapped the servlet to "DocServlet.pdf".

The acrobat plugin is now working in an iframe with this weird src:

<iframe id="bla1" src="" >

 

Is this behaviour correct in an iframe or did I miss something?

 

Michael

Reply via email to