Jay pratt

Greenhorn
+ Follow
since Oct 29, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jay pratt

There are two ways that I know of.
1) use an anchor tag in the page:
Link: <a href="#top">back to top</a>
Anchor tag placed at the top so the browser knows where to go: <a name="top"></a>

2) You can do it with Javascript: window.scrollTo(0,0)
13 years ago
JSF
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?

13 years ago
JSF