-1

I'm working on a Dynamic JSF page that read a List of lists. This list it`s load from a DataBase, then the number of elements can change.

I need to create one div for each of the elements in arrayList and then load the information on one table. (one div => one table)

(pseudocode jsp)

    %
    foreach(List Auxli: MainList){
    int count=0;
    <div id="count">
    <table>
    //information on auxLI
    </table>
    </div>
    count = count+1;
    }
    %

I don't know how to get this work on JSF because I only have the <h:dataTable> tag that read a object on Bean.
I read a object that contains the ArrayList, but I don't know who to cut to create the different Divs

Some one know how to do this?

Thanks to all

Finaly THE SOLUTION

The solution was use two <ui:repeat> with a KeySET of elements. This is very important because "repeat" cant iterate MAPS!!

 <ui:repeat value="#{main.MAP.keySet().toArray()}" var="item">
<DIV id=#{main.getNumber()}>
<ui:repeat value="#{main.MAP.get(item)}" var="item2">
</DIV>
</UI>
</UI>

The second repeat use the first element to take off from the list the information that we need. We get one div for each main element of the list and on the DIV we can use the information to make all you want!!! See you

Jorge A
  • 19
  • 5
  • An `` itself is an iterable JSF component in which case you do not have to do anything other than using the `var` and the `value` attributes appropriately. – Tiny Dec 19 '15 at 13:56
  • Im not asking how to use im askeing by the way to create dinamic Divs by the number objects in a list that contains more Lists. finally I found a possible solution on Thanks I will make my answer when its works – Jorge A Dec 19 '15 at 21:17
  • Please, if someone makes a negative vote, explay "beacause of". If somethings its wrong, all will be able to learn!!!! – Jorge A Jan 02 '16 at 22:03

2 Answers2

0

Unless you want to do that coding with plain JSF, the easier and better way would be to choose one of open source JSF component library. These libraries are built on top of JSF and provide some complex UI components and better AJAX support out of the box. One such framework is PrimeFaces and have a look at following link for the kind of functionality you are asking for: http://www.primefaces.org/showcase/ui/panel/accordionPanel.xhtml

0

what about the ui:repeat tag? you could iterate over a list of lists and include a dataTable for each iteration, declaring divs as you need them