I have list of string such this:
List<String> lista = Arrays.asList("Water","Pomegranate","Fish","Potato","Milk","Grape","steaks","parsley");//The list is big of that
This list repeat the category each 4 time I want to fetch each element under its category column as this in jsf page:
Drinks Fruits Meat Vegetables
Water. Pomegranate. Fish. Potato
Milk. Grape. steaks. parsley
ِِِِ... the others ...
I create Entity class:
public class Entity
{
private String drink;
private String fruit;
private String meat;
private String vegetable;
// getter and setter
}
How to do that?
I want to display element 0,4,8,12
.. in first column and element 1,5,9,13
in the second column and element 2,6,10,14
in the third column and element 3,7,11,15
in the fourth column and so on
Each element must be under its category
<p:layout fullPage="true">
<h:form>
<p:dataTable var="data" value="#{bean.list}">
<p:column headerText="Drinks" >
#{data.drink}
</p:column>
<p:column headerText="Fruits" >
#{data.fruit}
</p:column>
<p:column headerText="Meats" >
#{data.meat}
</p:column>
<p:column headerText="Vegis" >
#{data.vegetable}
</p:column>
</p:dataTable>
</h:form>
</p:layout>