【发布时间】:2012-10-26 00:39:30
【问题描述】:
我有 2 个下拉菜单:类型和代码。如果值 = A 或 B 或 C,我希望代码下拉列表根据类型下拉列表更改值。如何将 A 或 B 或 C 的值传递给侦听器,以便它可以理解和处理我的列表?
<h:outputLabel value="Type" for="idType" />
<h:selectOneMenu id="idType" value="#{myController.type}">
<f:selectItem itemLabel="AAA" itemValue="AAA" />
<f:selectItem itemLabel="BBB" itemValue="BBB" />
<f:selectItem itemLabel="CCC" itemValue="CCC" />
<f:ajax event="valueChange" listener="#{myController.changeCodeList}" render="idCode" execute="@this" />
</h:selectOneMenu>
<h:outputLabel value="Code" for="idCode" />
<h:selectOneMenu id="idCode" value="#{myController.code}" >
<f:selectItem itemLabel="Select ..." noSelectionOption="true" />
<f:selectItems value="#{myController.codeList}" />
</h:selectOneMenu>
【问题讨论】:
-
Ajax4jsf 是 RichFaces 的子库,带有
<a4j:xxx>库的标签。你似乎没有在任何地方使用它。那么请不要在您的问题上使用[ajax4jsf]标签。