Java – primefaces UI: duplicate does not work
•
Java
I'm trying to create an accordionpanel in primefaces I'm trying to create it using the UI: repeat, so I can create panel labels dynamically But somehow my code doesn't work. The accordionpanel is empty without any tabs Anyone can give me reasons or point out how I can achieve this goal
My beans
@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");
}
}
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 prints its work like this: o
<ui:repeat value="#{divisionList.divStrings}" var="divis">
<h:outputText value="#{divis}" />
</ui:repeat>
Solution
There's no problem with your UI: repeat, don't wrap it in an empty one
<p:accordionPanel >
Or delete uirepeat and fill in the value of accordionpanel
Do it in this way.
<p:accordionPanel value="#{test.divStrings}" var="divis" >
<p:tab title="#{divis}">
Content
</p:tab>
</p:accordionPanel>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
