Content from p:download inside a Dialog

UI Components for JSF
Post Reply
ccastro333
Posts: 65
Joined: 27 Feb 2011, 18:04

11 Sep 2011, 18:06

Hi,
I write here a case of use of p:download, because I am having troubles, I am sure there's a way to do what I want.
I have a table, from which users can select a row, and then a dialog displays with the current object in context. Typical, and working. But inside the dialog, there's a tabView, and inside one tab I want to put a link, and by clicking this link, I want a PDF to be displayed with the information of that object.
I am able to generate the pdf correctly, but, because the link which embeds p:download must be ajax=false, a full page reload is performed, and the stream back from the pdf method is lost. The result is that the dialog is closed, the tabView reset to the first tab, and no pdf is displayed.
But if I put that link in the first page (containing the table), outside the dialog, then it's displayed the open/save file dialog, which is my desired behavior. So, what should I for my pdf to be displayed from withing the dialog, without closing it?

My code:

Code: Select all

<p:dialog ....../>
<p:tabView...>
<p:tab>
<p:commandLink value="Download PDF" ajax="false"> 
          <p:fileDownload value="#{customerBean.myPdf}" contentDisposition="inline"/> 
</p:commandLink>
</p:tab>
</p:tabView>
<p:dialog>
myPdf is a Streamedcontent, and it's correctly generated.
Can yoy give me an idea or an alternative case to achieve the same functionality? Thanks
----------------------------------------------------------------------------
primefaces-3.4
mojarra-2.1.2-FCS
Tomcat 7

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests