【问题标题】:Jasper Report html output Image shows cached image in IE and Firefox but works all fine in ChromeJasper Report html 输出图像在 IE 和 Firefox 中显示缓存的图像,但在 Chrome 中一切正常
【发布时间】:2012-07-19 11:02:40
【问题描述】:

我在我的应用程序(JSF1.2、RichFaces 3.3.3、Portlet 桥)中生成了一个碧玉报告,但我遇到了一个问题。 jasper 生成的图像即使通过重新渲染其区域也不会动态变化。经过大量讨论和分析,我得出结论,因为 jasper 提供了同名的图像(新旧)......因此浏览器不会再次加载此图像并从缓存中获取此图像。我还在 xhtml(portlet) 的 head 部分添加了以下代码,但结果仍然没有改变。

<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Cache-Control" content="no-store"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="-1"/>

如果有人对此有解决方案,请告诉我。

【问题讨论】:

    标签: jasper-reports portlet jsf-1.2


    【解决方案1】:

    这是 Jasper 图像缓存的问题 这是代码

    只需将随机值与图像参数一起传递

    exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?random="+Math.random()+"&image=");

    【讨论】:

      【解决方案2】:

      如果整个报告是一张图片,你可以将这个 hack 托盘化

      <img src="/yourpath/imagename.png?{put_current_time_here or some random string}" /> 
      

      【讨论】:

      • 由于我没有从这个论坛找到任何答案,我找到了解决这个问题的方法。即我已重新加载页面,现在问题已解决。谢谢!
      猜你喜欢
      • 2016-02-09
      • 1970-01-01
      • 2023-04-11
      • 2016-01-15
      • 2020-05-08
      • 2013-03-04
      • 2018-07-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多