Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces UI:repeat not working

I'm trying to create accordionPanel in Primefaces.And i'm trying to create that using ui:repeat so i can create panel tabs dynamically.But somehow my code doesn't works, accordionPanel is empty and does not have any tabs.can any one give me the reason or point me how to achieve this.

here my bean.

@ManagedBean(name = "divisionList")
public class Divisions implements Serializable {

private List<String> divStrings;

public List<String> getDivStrings() {
        return divStrings;
    }
    public Divisions(){
        divStrings=new ArrayList<String>();
        divStrings.add("Division A") ;
        divStrings.add("Division B");
   }

}

and in my xhtml :

<p:accordionPanel >
         <ui:repeat value="#{divisionList.divStrings}" var="divis">
               <p:tab title="#{divis}">
                            Content
               </p:tab>
         </ui:repeat>
</p:accordionPanel>

EDIT:

But when it print like this its working :O

<ui:repeat value="#{divisionList.divStrings}" var="divis">
    <h:outputText value="#{divis}" />
</ui:repeat>
like image 759
sampathpremarathna Avatar asked Jan 15 '13 09:01

sampathpremarathna


1 Answers

There is no problem with your ui:repeat, don't wrap it inside an empty

<p:accordionPanel >

Or remove the uirepeat and fill in the value of your accordionPanel

Do like this

<p:accordionPanel value="#{test.divStrings}" var="divis" >
           <p:tab title="#{divis}">
                        Content
           </p:tab>
</p:accordionPanel>
like image 182
roel Avatar answered Sep 26 '22 16:09

roel