• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Dynamic Data Display in JSF

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic