vendredi 26 décembre 2014

Jstl checking checkboxes

I'm working with JSTL, and I'm trying to select checkboxes with a forloop. The problem is it doesn't work, nothing is checked. I think the error is in the line:



<c:if test="${field== 'company.id' }">


I don't know how I can write a ${} inside another ${}.



<c:forEach var="company" items="${companies}" varStatus="counter">
<li><input id="${counter.count}" class="companies" type="checkbox" onchange="checkButton('button1','companies')" name="companies" value="<c:out value="${company.id}" />"

<c:forEach var="field" items="${companyId}">
<c:if test="${field== 'company.id' }">checked="checked"
</c:if>
</c:forEach>>

<label for="${counter.count}"><c:out value="${company.name}"/></label></li>
</c:forEach>


Can somebody tell me how to fix this, so the right checkboxes get checked?





Aucun commentaire:

Enregistrer un commentaire