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>
Can yoy give me an idea or an alternative case to achieve the same functionality? Thanks