mercredi 22 juin 2016

How to create a condition using jsp tags?

I am a newbie with jsp, and I am trying to create a condition using core tags.

This is my code:

<c:set var="mssPresent" value="false"/>
<c:set var="mcoPresent" value="false"/>

<div>
    <c:forEach items="${model.familles}" var="famille">
        <c:if test="${famille.nom == 'MSS'}">
            <c:set var="mssPresent" value="true" />
        </c:if>
        <c:if test="${famille.nom == \"MCO\"}">
            <c:set var="mcoPresent" value="true" />
        </c:if>
        <div id="divInput">
            <input type="checkbox" value="${famille.valeur}" name="familles">
            <span class="champConsultationValeur" >${famille.nom}</span>
        </div>
    </c:forEach>
    <c:if test="${mssPresent eq false}">
        <div id="divInput">
            <input type="checkbox" value="6" name="familles" disabled>
            <span class="champConsultationValeur" >MSS</span>
        </div>
    </c:if>
    <c:if test="${mcoPresent eq false}">
        <div id="divInput">
            <input type="checkbox" value="6" name="familles" disabled>
            <span class="champConsultationValeur">MCO</span>
        </div>
    </c:if>
</div>

The problem is that I have always the disabled checkboxes even if when the first test is true, I tried to put strings inside "" and '' nothing changes.

Can you tell me where is the problem?

Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire