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
原文地址:https://www.cnblogs.com/yelanggu/p/13614816.html