【问题标题】:Primefaces graphicImage without ?pfdrid_c=true没有 ?pfdrid_c=true 的 Primefaces graphicsImage
【发布时间】:2015-05-29 13:26:59
【问题描述】:

我正在尝试在 primefaces 中渲染图形图像,但总是返回 404。 在 Chrome Debug 中,我可以看到这样的地址图像:

/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 不为空,因为我在 Debug 中检查了这个。 调试java代码我看到product.url没有?pfdrid_c=true,但是在浏览器Debug中出现?pfdrid_c=true。

这个 ?pfdrid_c=true 是一个 primefaces 常量,确实指的是动态缓存,但我不知道如何删除它?

【问题讨论】:

  • &lt;p:graphicImage cache="false" .../&gt; 但如果你得到404 那么这不应该是相关的。帖子中应该还有其他看不见的东西。
  • 嗯...primefaces 会自动添加 ?pfdrid_c=true,没有它,图像就会被渲染。
  • 如果图像 URL 正确,则无论cache 的值如何,图像都应照常显示。您是否尝试过硬刷新页面(大多数浏览器上为F5)或清除浏览器的历史记录?
  • 当我用 F5 刷新页面时,图像被渲染。
  • 那个不存在的图像(可能是从中间磁盘上的物理位置删除)直接从缓存中提供(在F5 被攻击之前)。

标签: jsf primefaces


【解决方案1】:

我对图像的primefaces这个组件也有同样的问题,因为它添加了用于控制Cache-Control的参数?pfdrid_c=true

我是这样使用它的(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,则无效。 &lt;h:graphicImage&gt; 不支持此功能

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-26
    • 1970-01-01
    • 1970-01-01
    • 2011-12-25
    • 2021-10-21
    • 1970-01-01
    相关资源
    最近更新 更多