0

I'm working with JSF and JSTL, the code above doesn't work!

<ui:repeat var="reponse" value="#{gPost.reponses}">                                             UserLogin : #{reponse.utilisateur.login}
    <c:if test="${reponse.utilisateur.login eq 'X'}">
        Utilisateur equivalent X
    </c:if>
</ui:repeat>

This code iterate, i have two element to be iterated, the output is this :

UserLogin : Y
UserLogin : X

It must be :

UserLogin : Y
UserLogin : X
Utilisateur equivalent X

The tag <c:if test="${reponse.utilisateur.login eq 'X'}"> is not correct?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Potinos
  • 371
  • 3
  • 5
  • 15

1 Answers1

1

JSTL tags like <c:if> runs during view build time, while JSF components like <ui:repeat> runs during view render time. So, with your code given so far, the #{reponse} is not available while JSTL is running, because <ui:repeat> hasn't run. You need a normal JSF component with rendered attribute instead.

<h:panelGroup rendered="#{reponse.utilisateur.login eq 'X'}">
    Utilisateur equivalent X
</h:panelGroup> 

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555