二级菜单取数据库值

这里的二级菜单中的一级选项不可选:

<label style="pad2ing-left: 250px" class="control-label" for="inputSuccess4">所属部门:</label>
<select id="in-ot-depart" name="departId" class="selectpicker" data-hide-disabled="true" data-live-search="true" style="height: 34px;width: 217px">
<s:iterator id="d3" value="userInfo.userDepartments(当前用户的所属部门,用来把该部门直接显示在select中)">
<s:iterator id="d" value="DepartmentList(这个列表是在action中调用方法查询数据库取得(查询父级部门))">
<optgroup label="${d.depname }">//这个是父级部门,不可选
<s:iterator id="d2" value="#d.userdepartmentList" status="depart1">//userdepartmentList为部门类中的查询子部门的方法列表
<c:choose>
        <c:when test="${d2.id==d3.id }">//当遍历的部门id=当前用户的部门id时,选中值为这个部门
            <option selected value="${d2.id }">${d2.depname }</option>
        </c:when>
        <c:otherwise>
            <option value="${d2.id }">${d2.depname }</option>
        </c:otherwise>
</c:choose> 
</s:iterator>
</optgroup>
</s:iterator>
</s:iterator>
</select>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值