有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在编辑时突出显示多选框选定项

<select name="projecttype"  class="selt-box"  onfocus="window.dropdown_menu_hack(this)">
  <c:forEach items="${lookupdetails}" var="lookupdetails" >
    <c:if test="${not empty lookupdetails.lookupName && lookupdetails.lookupId==16}">                                           <option   value="${lookupdetails.lookupdetailId}">${lookupdetails.lookupName}</option>
    </c:if>
  </c:forEach>   
</select>

上面的代码是一个多选框。请告诉我如何使所选值突出显示。。编辑时。。 我使用了控制器中的value = ${xx},它是所选的值。。它不起作用。。pl帮助


共 (1) 个答案

  1. # 1 楼答案

    这可以通过使用spring的表单:select标记来存档。请看一看可以涵盖您的场景的片段

    <form:select path="lookupdetails" multiple="true">
        <form:options items="${lookupdetails}" itemLabel="lookupName" itemValue="lookupId" />
    </form:select>
    

    Spring将为lookupDetails集中的对象生成预先选择的html

    问候,, 赫曼斯