选择了jstl下拉列表

时间:2012-11-29 19:50:26

标签: spring jsp jstl

所以我有一个类似于下面所示的弹簧绑定下拉列表。我想问的问题 每当getAllID值为true时,将ALL ID显示为所选选项。我知道选中的 value是基于spring绑定元素提供的值,在这种情况下是studentID但是无论如何我可以在我的布尔条件为真时覆盖它吗?

<spring:bind path="student.studentID">      
   <select name="${status.expression}" value="${status.value}">
       <option />
    <option value="001">1</option>
    <option value="002">2</option>
    <option value="003">3</option>
    <option value="ALLID"
        <c:if test='${student.getAllID eq true}'> Selected </c:if>>ALL ID
    </option>

     </select>
</spring:bind>

1 个答案:

答案 0 :(得分:0)

我想我得到了修复。添加了c:if to Select tag:

<c:if test='${student.getAllID ne true}'>
            value="${status.value}" 
</c:if>