zoukankan      html  css  js  c++  java
  • spring <form:checkboxes> tag and css class

    I have issue with:

    <form:checkboxes path="roles" cssClass="checkbox" items="${roleSelections}"/>

    If previous line is used in jsp, then generated html looks like:

    <span><input id="roles1" name="roles"class="checkbox" type="checkbox" value="ROLE_NEWUSER"/><label for="roles1">ROLE_NEWUSER</label></span><span><input id="roles2" name="roles"class="checkbox" type="checkbox" value="ROLE_USER" checked="checked"/><label for="roles2">ROLE_USER</label></span><span><input id="roles3" name="roles"class="checkbox" type="checkbox" value="ROLE_EDITOR"/><label for="roles3">ROLE_EDITOR</label></span><span><input id="roles4" name="roles"class="checkbox" type="checkbox" value="ROLE_ADMINISTRATOR"/><label for="roles4">ROLE_ADMINISTRATOR</label></span>

    Please notice that css class is added to input tag. Instead css class is added to input tag I need this class to be added to span tag. Is there any solution to my problem, other then using < c:forEach > tag

    Thanks in advance. Sorry if question is duplicate. If so, please point me to original question.

    You can try this:

    <c:forEach var="item" items="${roleSelections}"><span class="checkbox"><form:checkbox path="roles" value="${item}"></span></c:forEach>

    OR!!!!!!!!!!!!!!!!!!!!!!!!!

    All you need to do is to specify 'element' attribute :

    <form:checkboxes path="roles" element="span class='checkbox'" items="${roleSelections}"/>
  • 相关阅读:
    hdu 母牛的故事 递推题
    并查集
    又是矩阵 Uva上的一道 经典题目
    poj 3233 矩阵幂取模
    electronvue + elementui构建桌面应用
    主板cmos 映射表
    高级配置与电源接口 acpi 简介
    警告不能读取 AppletViewer 属性文件的解决方法
    高级 Synth(转载)
    vbs 查看硬件信息代码
  • 原文地址:https://www.cnblogs.com/reynold-lei/p/3195132.html
Copyright © 2011-2022 走看看