Search code examples
jsfjsf-2primefacesgraphicimage

Primefaces graphicImage always showing the same picture


I'm using primeFaces to display the coverimage of a series in it's detailView. My problem is, that it is always showing the same picture, except if I refresh my cache (Strg+F5 in Chrome).

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). I've seen some people using <f:param> to give the params to the method loading the picture.

I'd really appreciate some help - has <p:graphicImage> some quirks or am I just using it wrong?


Solution

  • As stated in the documentation, by default the p:graphicImage is caching, you must add cache="false" in order to force a refresh.

    More info