I'm working with an app that uses JSP 2 and JSF 1.2. There are many uses of h:graphicImage like so:
<h:graphicImage value="/img/foo.gif" />
<h:graphicImage url="#{request.contextPath}/img/bar.gif" />
The response headers tell the browser to cache the image, but there is currently no way of invalidating the cache. The workaround is to rename the images when they are change. I'd like to figure out how to patch h:graphicImage so that it can add a cache version string to the resuting <img> src attribute like this:
<img src="/img/foo.gif?cache=201011040801" />
One solution is to go through all the JSP pages and add this in, but I'm hoping for a transparent solution. My initial attempts at creating a custom renderer have failed, but here is what I was trying:
Has anyone else solved this problem with the graphicImage tag?