用JSTL和struts2标签实现复选框的选中
    页面上得到两个list集合,一个list集合是展示所有,另一个list是封装用户选中的。当它们的ID相等则复选框被选中。
代码实现一(JSTL)
<c:forEach items="${sessionScope.all_suit}" var="suit">
        				<input type="checkbox" name="classes"  
        				<c:forEach items='${requestScope.groupVideoinfo.suitobjectList}' var='item'><c:if test="${suit.code == item.objectid}">checked</c:if></c:forEach>
        				value="${suit.code}" />${suit.name}     
        		</c:forEach>   
代码实现二(struts2)
<s:iterator id="oo" value="%{#request.gradeList}" >
    <input type="checkbox" name="v_studyobject" id="v_studyobject" 
           <s:iterator id="co" value="%{#request.dto.suitobjectList}">
        <s:if test="%{#co.objectid==#oo.code}">
            checked="checked" 
        </s:if>
       </s:iterator>
value="${oo.code}"/>${oo.name}                  
</s:iterator>
关键就是,我们循环比较,从而确定input标签中的checked属性的有无。