如下:
<html> <body> <div class="container"> <h4>修改用户角色</h4> <#function contain userList roleTypeId> <#local num=0> <#list userList as userList> <#if userList.roleTypeId ==roleTypeId> <#local num = num +1 > </#if> </#list> <#return num> </#function> <form role="form" method="post" action="/userManage/userRoleSave" enctype="multipart/form-data"> <label class="label-tips" for="u">账号:</label> <span id="username">${(userinfo.username)!''}</span><p> <label class="label-tips" for="nickname">昵称:</label> <span id="nickname">${(userinfo.nickname)!''}</span><p> <label class="label-tips" for="roles">已有角色:</label><p> <#list userinfo.roles as userRoleList> <tr> <td> <span id="roleName">${(userRoleList.roleTypeId)!''}.${(userRoleList.roleName)!''}    </span> </td> </tr> </#list><p> <label class="label-tips" for="u">修改角色: </label><p> <#list roles as rolesList> <input type="checkbox" name="roleTypeIdList" id="sexMAN" value="${(rolesList.roleTypeId)!''}" <#if contain(userinfo.roles,rolesList.roleTypeId)==1 > checked="checked" </#if>>${(rolesList.roleTypeId)!''}.${(rolesList.roleName)!''}     </#list> <input hidden type="text" name="userid" value="${(userinfo.userid)!''}"><p> <input type="submit" name="修改"/>${(msg?if_exists)!''} </form> </div> </body> </html>