Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display using DataTable

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a list of items. Lets say list has the following elements: A,B,C,D,E,F.
I want to display these elements in a h:dataTable in the following manner.

A B C
D E F

arranged in 3 cols and in the said fashion above.
I am new to JSF and am struggling to get it.
If any one has some sample code or any pointers, please post it back.
That will be of great help.

Veera
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Veera,

I don't think that the h:datatable is a good way to solve this problem. I would use the datatable component for collections of complex objects, but to display simple strings in a table I would use the h:panelGrid tag:


Note that I've use the forEach-tag of the JSTL and so I had to make sure that the JSTL is installed on my server. To complete the coding you need a PoJo which you bind to the myBean variable (faces-config.xml).

Your Bean needs a getItems method:
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic