I have a PDF document that is generated from the data contained in the application, this pdf document is displayed using the media component primefaces, everything works fine, but to make changes to the data source I still shows the old document. So far I have solved by clearing the browser cache, but how could this problem solucioanr programming?
<p:media value="#{listadoFacturasMB.fileDownload}" width="100%" height="600px" player="pdf">
<f:param name="id" value="#{listadoFacturasMB.selectedFactura.idFactura}" />
</p:media>
I have tested it with primefaces 5.3 and the media tag in there has an attribute cache
which has true as default value, set it to false and it will always load the file from the server instead of cache
Part of the answer I found here: link I just had to force the component that always had a different id though it were the same document. That's what this code in xhtml:
<p:media value="#{serviciosMB.servicioDownload}" width="100%" height="600px" player="pdf">
<f:param name="id" value="#{serviciosMB.idFile}" />
</p:media>
backing bean:
public String getIdFile() {
return java.util.UUID.randomUUID().toString();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With