Thymeleaf遍历选中多个复选框

使用场景:用户角色一对多关联关系

<!-- roleList:所有角色信息 ;userRoleList:用户已有角色id列表-->
<input th:each="role:${roleList}"  type="checkbox"  th:value="${role.id}" th:checked="${#lists.contains(userRoleList, role.id)}" th:text="${role.role_na
posted @ 2020-09-04 17:03  野狼谷  阅读(1562)  评论(0编辑  收藏  举报