I’m trying to do a thumbnail gallery on my web page so that when one is clicked the full size image is shown. The images are stored in a backing bean and are shown with an tag.
<li>
<a href="????">
<ice:graphicImage value="#{screenshot.image}" styleClass="thumb"/>
</a>
</li>
When on the page, I see the images have addresses like /block/resource/MjY0OTc3Mzc1/ since they are served by the Icefaces blocking servlet.
What i need to know is how to get the link to the image so i can put it in the element.
Thanks for any help !
In this particular situation, your best bet is likely JavaScript. When the page is finished loading, grab all
<img>elements with classnamethumb, extract thesrcattribute, locate the parent<a>and update itshrefattribute accordingly.But I wouldn’t do that. One, it’s bad for user experience. Two, it won’t work on JS disabled clients. Three, storing raw images in a bean is memory hogging. Rather store the images on local disk file system and link to them directly or, when outside the public webcontent or in a database, using a servlet. Then in your managed bean just have a collection of URL’s to the images (or the servlet) and let the servlet stream them sequentially accordingly. You can find here a basic example of such a servlet and here a more advanced one supporting caching and resume.