I'm using the h:graphicImage tag in JSF. Is there a way to show a blank image (i.e. blank.jpg) if there is a broken or not found image?
views:
28answers:
1
+1
A:
There are two ways:
- client side - with javascript, see here
- server side (less preferable) make an
ImageServletwhich takes an image url, loads it and sees if it exists. If it exists, it is streamed to to client. If not - the blank.jpg is streamed to the client. Verification can be done vianew File(fullPathToImage).exists(), or, if the image is not on your server, usingURL.openConnection().
Bozho
2010-09-09 20:58:33