4

I have to display a list of element in groups. I am expecting out like in the image.

enter image description here

If I remove if condition its printing all option in all groups.

<p:accordionPanel value="#{menuView.menunames}" var="name">
            <p:tab title="#{name}">
                <c:forEach items="#{menuView.menu}" var="entry">

                <h:outputText value="(#{entry.key} == #{name})"></h:outputText>
                    <c:if test='#{entry.key} == #{name}'>
                        <h:dataTable value="#{entry.value}" var="submenu">
                            <h:column>
                                <h:outputText value="#{submenu}" />
                            </h:column>
                        </h:dataTable>
                    </c:if>
                </c:forEach>
            </p:tab>
    </p:accordionPanel>

  private Map<String, List<String>> menu;
  private List<String> menunames;
Mohamed Badr
  • 2,562
  • 2
  • 26
  • 43
Prashant Vhasure
  • 916
  • 2
  • 7
  • 18

2 Answers2

2

The EL expression should be like this:

<h:outputText value="#{entry.key == name}">
<c:if test="#{entry.key eq name}">
f1l0
  • 56
  • 5
0

I use a c:choose for this, with the c:when for the if part and c:otherwise for the else part.

user207421
  • 305,947
  • 44
  • 307
  • 483