jsp页面数据回显(checkbox+c标签)
已经传递过来了2个列表集合 List<TbCourse> courseList 和 List<TbClazz> clazzList以及student信息TbStudent tbStudent
下面是TbCourse的属性
private Integer bid;
private String bname;
TbClazz的属性
private Integer cid;
private String cname;
student属性
private Integer id;
private String name;
private String sex;
private Integer bid;
private String bname;
实现课程的回显
<c:forEach items="${courseList }" var="c">
<input type="checkbox" name="course" id="" value="${c.cid }"
<c:forEach items="${tbStudent.courses }" var="cc">
<c:if test="${c.cid==cc.cid }">
checked=true
</c:if>
</c:forEach>
/>${c.cname }
</c:forEach>
关于select下拉选择框的回显可以看这篇文章
https://blog.youkuaiyun.com/illusory_germ/article/details/96196325
本文介绍如何在JSP页面上使用c标签实现多选框(checkbox)的数据回显功能,具体展示了如何通过遍历课程列表来设置已选课程的状态,并提供了select下拉框回显的相关链接。
2619

被折叠的 条评论
为什么被折叠?



