JSP 頁面 checkbox 實現單選、多選效果

核心代碼:java

roleList:request.setAttribute("roleList", roleList);(java代碼)spa

主要是修改 type 類型:input

    單選:type="radio"it

    多選:type="checkbox"io

-----------------------------------------------------------------------------------------------------------test

<c:forEach var="role" items="${roleList}" varStatus="status">List

             <c:if test="${userRole.roleId eq  role.roleId}">
                            <input type="radio" name="roleId" value='${role.roleId}' checked="checked"/>request

                            ${role.roleName}
              </c:if>
              <c:if test="${userRole.roleId != role.roleId}">
                            <input type='radio' name="roleId" value='${role.roleId}'/>${role.roleName}
              </c:if>                   checkbox

</c:forEach>di

相關文章
相關標籤/搜索