我有以下问题:当我将一些数据放入模型中时,我希望在视图部分检查一些复选框,这些复选框等于我的对象中的字段名称。这是html代码:
<div class="myDiv">
<div class="divClass">
<input type="checkbox" name="someData" value="0" id="id1">
<label for="id1">Field1</label>
</div>
<div class="divClass">
<input type="checkbox" name="someData" value="1" id="id2">
<label for="id2">Field2</label>
</div>
<div class="divClass">
<input type="checkbox" name="someData" value="2" id="id3">
<label for="id3">Field3</label>
</div>
<div class="divClass">
<input type="checkbox" name="someData" value="3" id="id4">
<label for="id4">Field4</label>
</div>
</div>
这是我想要获得的jstl pseudo_code:
<c:forEach var="field" items="${list.fields}">
<c:if test="${field.name=='FIELD(1-4)'}">CHECK_THE_APPROPRIATE_CHECKBOX
</c:if>
</c:forEach>