简体   繁体   English

如何在未使用ID的下拉列表中加载值……隐藏所有已使用其值的记录?

[英]How to load values in dropdown whose ID is not used…hide all records whose values are already used?

This shows all the records.Please help me to show only the records whose id is not used .. 这将显示所有记录。请帮助我仅显示未使用ID的记录。

<select name="userDetailId" class="form-control" required>
          <option value="">Select</option>

         <c:forEach items="${userDetailList}" var="userDetail">

         <option value="${userDetail.userDetailId}" <c:if test="${userDetail.userDetailId == dataMap.userDetailId}"> selected </c:if> >${userDetail.name}</option>

         </c:forEach>
     </select>

Create some flag let's say isUsed and populate it's value as either true/ false ie used or not and add similar condition as below. 创建一些标志,比如说isUsed,并将其值填充为true / false(即是否使用),然后添加类似的条件,如下所示。

<select name="userDetailId" class="form-control" required>
          <option value="">Select</option>

         <c:forEach items="${userDetailList}" var="userDetail">
<c:if test="${isUsed}"> 
         <option value="${userDetail.userDetailId}" <c:if test="${userDetail.userDetailId == dataMap.userDetailId}"> selected </c:if> >${userDetail.name}</option>
</c:if> 
         </c:forEach>
     </select>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM