File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic Data Display in JSF

 
Raj Maheshwari
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks!
Raj
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks
Raj
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic