简体   繁体   English

Primefaces graphicImage始终显示同一张图片

[英]Primefaces graphicImage always showing the same picture

I'm using primeFaces to display the coverimage of a series in it's detailView. 我正在使用primeFaces在其detailView中显示系列的封面图像。 My problem is, that it is always showing the same picture, except if I refresh my cache (Strg+F5 in Chrome). 我的问题是,除非刷新缓存(Chrome中的Strg + F5),否则它始终显示相同的图片。

My code to display the picture is the following 我显示图片的代码如下

<ui:define name="content">
    <h:body>
        <f:view>
            <h:form>
                <h1>#{seriesController.selectedSeries.name}</h1>
                <p:graphicImage value="#{coverController.getFirstCoverOfSeries(seriesController.selectedSeries.id)}"/>
                [Here are some fields...]
            </h:form>
        </f:view>
    </h:body>
</ui:define>

I already checked my controller manually - it loads the cover just fine, but primeFaces does not display it correctly (Controller returns a DefaultStreamedContent with the byte[] and the correct type). 我已经手动检查了控制器-可以很好地加载封面,但是primeFaces无法正确显示它(控制器返回带有byte []和正确类型的DefaultStreamedContent)。 I've seen some people using <f:param> to give the params to the method loading the picture. 我见过有人使用<f:param><f:param>赋予加载图片的方法。

I'd really appreciate some help - has <p:graphicImage> some quirks or am I just using it wrong? 我真的很感谢您的帮助- <p:graphicImage>古怪,还是我使用错了?

As stated in the documentation, by default the p:graphicImage is caching, you must add cache="false" in order to force a refresh. 如文档中所述,默认情况下p:graphicImage缓存状态,必须添加cache="false"才能强制刷新。

More info 更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM