嗨,我有列表框和单选按钮组jsf1.1
更改单选按钮值时需要更改列表框中选定的值我在单选按钮ValueChangeEvent下设置,它当时的设置,但之后它再次调用一些内置类,它更改为以前的值。
下面是JSF代码。。。
<ui:listbox binding="#{weka$DataMining.listbox_pidGroups}" id="listbox_pidGroups"
items="#{VisualAnalyticsSessionBean.pidStaticInfo.pidGroupsForClusterTree}" label="PID Groups" labelOnTop="true" multiple="true"
rows="5" selected="#{VisualAnalyticsSessionBean.pidStaticInfo.selectedGroup}"/>
<h:panelGrid binding="#{weka$DataMining.gridPanel_ClusterType}" id="gridPanel_ClusterType" style="">
<ui:radioButtonGroup binding="#{weka$DataMining.radioButtonGroup_clusters}" id="radioButtonGroup_clusters"
items="#{VisualAnalyticsSessionBean.fsdfOptions.clusters}" onClick="common_timeoutSubmitForm(this.form, 'gridPanel_ClusterType')"
selected="#{VisualAnalyticsSessionBean.fsdfOptions.clusterType}" immediate="true" valueChangeListener="#{weka$DataMining.clustergroup_processValueChange}"/>
<ui:radioButton binding="#{weka$DataMining.radioButton_SingleCluster}" id="radioButton_SingleCluster" label="Single Cluster"
name="radioButton-group-gridPanel_ClusterType" rendered="false" selected="#{VisualAnalyticsSessionBean.pidParameters.singleCluster}"/>
您已经在单选按钮组组件上设置了immediate="true"
。这意味着,所有其他没有设置immediate="true"
的输入组件,如列表框组件,都不会从模型中设置和获取它们的值。您的问题症状表明您正在通过更改模型值来更改列表框值。您需要重写值更改侦听器代码,以便它直接在组件上设置更新后的值。您已经将listbox组件绑定到bean的listbox_pidGroups
属性,因此需要对其调用setValue()
。
类似的东西
listbox_pidGroups.setValue(newValue);