单选按钮值更改需要更改列表框中选定的项目

时间:2012-01-09 06:31:49

标签: jsf netbeans

您好我有列表框和单选按钮组jsf1.1

更改单选按钮值需要更改列表框选择的值 我在单选按钮ValueChangeEvent下设置,它设置的时间,但之后它再次调用一些内置的类,它改为以前的值。

下面是JSFcode ...

 <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}"/>

1 个答案:

答案 0 :(得分:0)

您已在单选按钮组组件上设置immediate="true"。这意味着没有设置immediate="true"的所有其他输入组件(如列表框组件)将不会设置并从模型中获取其值。您的问题症状表明您通过更改模型值来更改列表框值。您需要重写值更改侦听器代码,以便它直接在组件上设置更新的值。您已将列表框组件绑定到bean的listbox_pidGroups属性,因此您需要在其上调用setValue()

这样的东西
listbox_pidGroups.setValue(newValue);