File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Dynamic Data Display in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Dynamic Data Display in JSF" Watch "Dynamic Data Display in JSF" New topic

Dynamic Data Display in JSF

Raj Maheshwari
Ranch Hand

Joined: Jul 02, 2004
Posts: 34
Hi Everyone,

I'm trying to achieve the following:

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?

Any help/suggestion will be appreciated.

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
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
Raj Maheshwari
Ranch Hand

Joined: Jul 02, 2004
Posts: 34
Hi Abiodun,

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?

I agree. Here's the link:
subject: Dynamic Data Display in JSF
jQuery in Action, 3rd edition