二级菜单取数据库值

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

<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>

你可能感兴趣的:(项目笔记,数据库,select)