I`m developing a JSF application and I have a question regarding a Facelets page with JSTL. I want to display in an ui:repeat a number of question, a question and 3 answers (formated conditionally) and in front of the answers a tick (tickSmall.png) or an X (xSmall.png) if the questions are right or wrong.
The answers are formated correctly, but the tick / X is not put correctly (I checked the booleans are correct, some are true, some are false). EVERY time it puts an X, even if there should be a tick.
I have included xmlns:c="http://java.sun.com/jsp/jstl/core
The code:
<ui:repeat var="n"
value="#{answerResultBean.accessWrongAnswerColumnWrapperList}">
<hr />
<h:outputText value="#{n.noQuestion}. #{n.question}" />
<h:panelGrid columns="2" style="text-align: left;">
<c:choose>
<c:when test="#{n.rightGridAnswerA}">
<h:form>
<img src="/juritest/resources/img/tickSmall.png" alt="tick" />
</h:form>
</c:when>
<c:otherwise>
<h:form>
<img src="/juritest/resources/img/xSmall.png" alt="wrong" />
</h:form>
</c:otherwise>
</c:choose>
<h:outputText value="a) #{n.a}"
style="#{n.userAnswerA ? 'font-weight:bold;' : 'font-weight:normal;'}" />
<c:choose>
<c:when test="#{n.rightGridAnswerB}">
<h:form>
<img src="/juritest/resources/img/tickSmall.png" alt="tick" />
</h:form>
</c:when>
<c:otherwise>
<h:form>
<img src="/juritest/resources/img/xSmall.png" alt="wrong" />
</h:form>
</c:otherwise>
</c:choose>
<h:outputText value="b) #{n.b}"
style="#{n.userAnswerB ? 'font-weight:bold;' : 'font-weight:normal;'}" />
<c:choose>
<c:when test="#{n.rightGridAnswerC}">
<h:form>
<img src="/juritest/resources/img/tickSmall.png" alt="tick" />
</h:form>
</c:when>
<c:otherwise>
<h:form>
<img src="/juritest/resources/img/xSmall.png" alt="wrong" />
</h:form>
</c:otherwise>
</c:choose>
<h:outputText value="c) #{n.c}"
style="#{n.userAnswerC ? 'font-weight:bold;' : 'font-weight:normal;'}" />
</h:panelGrid>
</ui:repeat>