This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I want to display images inside a table on multiple rows: 2 on each row (so there will be 2 columns). I know that the number of images is anywhere between 4 to 20 (which means that I should dynamically be able to generate anywhere between 2 to 10 rows).
I have a bean which can return an arraylist of names of each image file. From there on, how can I use JSF to render the image thumnail and a url to the image?
I tried to use a panelgrid, but how do I make it such that it is dynamic?
If I understand the question , you want to make it dynamic in the sense that the Table keeps on refreshing and displaying different Images based on the Data it gets, The best way to do this is either use ajaxanywhere or the Oracle Poll Tag that you an set a time interval to poll for data thereby making the table dynamic, I would also recomend a datatable, which embeds an img Tag. The Datatable receives a List of Map values from a Bean
Joined: Jul 02, 2004
Thanks for the reply. Well not exactly dynamic in the way you described. Putting it simply, I have an arraylist (or any collection) of Strings which are names of images. This list is generated randomly when the page gets loaded (or refreshed).
How can I display this list such that: There are no more than two columns in the table. The number of rows can increase/decrease based on the number of images (And is thus dynamic).
I guess what I'm really looking at is how can I bind a list to a panelgrid easily?