我试图在 primefaces 中渲染图形图像,但总是返回 404。 在 Chrome 调试中我可以看到这样的地址图像:
/UltracarWeb/Images/1427303591376_image.png?pfdrid_c=true"
使用我更改的 Chrome 调试:
/UltracarWeb/Images/1427303591376_image.png?pfdrid_c=false" , then the image is rendered.
我在xhtml中这样调用graphicImage:
<p:graphicImage style="max-width: 110px; max-height: 140px;"
value="#{product.PhotoUrl}"
rendered="#{not empty product.Url}">
</p:graphicImage>
我已经尝试过使用缓存 false 和 true,但仍然不起作用。
该 url 不为空,因为我在调试中检查了这一点。 调试java代码我看到product.url没有?pfdrid_c=true,但在浏览器调试中出现?pfdrid_c=true。
这个?pfdrid_c=true是一个primefaces常量,确实引用了动态缓存,但我不知道如何删除它?
最佳答案
我对图像的 primefaces 组件也遇到了同样的问题,因为它添加了参数 ?pfdrid_c=true
用于控制Cache-Control
我像这样使用它(primefaces元素):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"...>
<p:graphicImage value="#{product.PhotoUrl} />
我选择使用另一个非常适合我的 jsf 元素,因为它不引入参数:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"...>
<h:graphicImage value="#{product.PhotoUrl} />
仅当该值为表示 URL 的字符串时,此方法才有效,但如果该值为 DefaultStreamedContent
,则此方法不起作用。 。 <h:graphicImage>
不支持此功能
关于jsf - Primefaces 图形图像不带 ?pfdrid_c=true,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29263061/