有的时候,不得不使用循环中的索引,比如label对应的单选多选:
<c:forEach items="${lpalls }" var="pall" varStatus="status"> <label for="${status.index}">${pall.name}</label> <input type="checkbox" value="${pall.id}" /> </c:forEach>
这样就有label指向到唯一的input标签啦