SpringMvc 中绑定 checkbox 标签到form 中的List

<table align="center">
        <tr>
            <td>ID</td>
            <td>Role Name</td>
        </tr>
        <c:forEach items="${roleList}" var="role">
            <tr>
                <td><form:checkbox path="roles" value="${role}" label="${role.id}" /></td>
                <td><c:out value="${role.name}" /></td>
            </tr>
        </c:forEach>
</table>

<from:checkboxes> 标签中的items 只能是数组、list<String>  、map

<div class="controls">
     <c:forEach items="${smsGroups}" var="smsGroup" varStatus="status">
           <tr>
               <form:checkbox path="smsGroups[${status.index}].groupid" 
                            value="${smsGroup.groupid}" label="${smsGroup.groupname}" />
           </tr>
     </c:forEach>
 </div>
原文地址:https://www.cnblogs.com/leonkobe/p/6214235.html