Reputation: 163
I am trying to render a graphic image in primefaces but always returns a 404. In Chrome Debug I can see the address image like this:
/UltracarWeb/Images/1427303591376_image.png?pfdrid_c=true"
Using the Chrome Debug I changed for:
/UltracarWeb/Images/1427303591376_image.png?pfdrid_c=false" , then the image is rendered.
I call the graphicImage in xhtml this way:
<p:graphicImage style="max-width: 110px; max-height: 140px;"
value="#{product.PhotoUrl}"
rendered="#{not empty product.Url}">
</p:graphicImage>
I already tryed with cache false and true, and still not work.
The url is not empty because I checked this in the Debug. Debugging the java code I saw the product.url without the ?pfdrid_c=true, but in browser Debug the ?pfdrid_c=true appears.
This ?pfdrid_c=true is a primefaces constant do refers the dynamic cache, but I don't know how can I remove it?
Upvotes: 2
Views: 2789
Reputation: 3610
I have had the same problem with this component of primefaces to images, because it adds the parameter ?pfdrid_c=true
used to control the Cache-Control
I was using it like this (primefaces element):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"...>
<p:graphicImage value="#{product.PhotoUrl} />
and I chose to use this other jsf element that works perfectly for me since it does not introduce parameter:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"...>
<h:graphicImage value="#{product.PhotoUrl} />
This works only if the value is a String representing an URL but this does not work if the value is a DefaultStreamedContent
. This isn't supported by <h:graphicImage>
Upvotes: 2