概述
这里的二级菜单中的一级选项不可选:
<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>
最后
以上就是优美水壶为你收集整理的二级菜单取数据库值的全部内容,希望文章能够帮你解决二级菜单取数据库值所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复