使用c:choose和f:selectOneListBox实现多重嵌套,要求:booktype中选中不同子项时,子分类selectOneListbox的选项不同
<h:selectOneListbox value="type"
id="booktype"
size="1"
label="#{bookBean.type}"
valueChangeListener="#{bookCtrl.changetype}"
onchange="submit()"
immediate="true">
<f:selectItem itemValue="computer" itemLabel = "计算机"></f:selectItem>
<f:selectItem itemValue="literature" itemLabel = "文学"></f:selectItem>
<f:selectItem itemValue="manage" itemLabel = "管理"></f:selectItem>
<f:selectItem itemValue="other" itemLabel = "其他"></f:selectItem>
</h:selectOneListbox>
<c:choose>
<c:when test="${type==computer}">
<h:selectOneListbox value="type1"
id="booktype1"
size="1"
label="#{bookBean.type1}"
valueChangeListener="#{bookCtrl.changetype1}"
onchange="submit()"
immediate="true">
<f:selectItem itemValue="softwareEngineering" itemLabel = "软件工程"></f:selectItem>
<f:selectItem itemValue="computerNetwork" itemLabel = "计算机网络"></f:selectItem>
<f:selectItem itemValue="ProgrammingLanguage" itemLabel = "编程语言"></f:selectItem>
<f:selectItem itemValue="other" itemLabel = "其他"></f:selectItem>
</h:selectOneListbox>
</c:when>
相关分类