The best option for your case seems to be to use HTML <img />
tag. Surprisingly, most of image cache solutions are based in a random generated String, as there is no HTML standard way to achieve it. That will cheat the browser and force it to download it again.
There's no need to hardcode the image path more than once, just make use of <ui:param />
to keep variales in facelets.
<ui:param name="imageFolder" value="resources/images" />
<img src="#{imageFolder}/image.jpg?#{currentDate.time}" />
Where #{currentDate}
is a current Date
instance. This can be implemented by adding a request scoped bean to your faces-config:
<managed-bean>
<managed-bean-name>currentDate</managed-bean-name>
<managed-bean-class>java.util.Date</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
That evaluates to kind of:
<img src="resources/images/image.jpg?1403302512505">
So your current image will be retrieved in each request.
Another choice is to disable the entire browser cache at web-filter level, despite this would affect your whole content.
See also: