<h:panelGrid>
<h:selectOneListbox size="1" style="width:100px;" value="#{baseMaterialBean.provinceValue}">
<f:selectItem itemValue="-1" itemLabel="请选择" />
<f:selectItems value="#{baseMaterialBean.provinceList}" />
<a4j:support event="onchange" actionListener="#{baseMaterialBean.provinceChange}"
                           reRender="city">
</a4j:support>
</h:selectOneListbox>

<h:selectOneListbox size="1" id="city" style="width:100px;"value="#{baseMaterialBean.city}">
<f:selectItem itemValue="-1" itemLabel="请选择" />
<f:selectItems value="#{baseMaterialBean.cityList}" />
<a4j:support event="onchange"actionListener="#{baseMaterialBean.cityChange}">
</a4j:support>
</h:selectOneListbox>
</h:panelGrid>
完全没有理由 第一个box改变值的时候。onchange的时候provinceChange不被调用:
后面的对应方法:public void provinceChange(ActionEvent event) {
     System.out.println("change.........");
}问题在什么地方??在线等。

解决方案 »

  1.   


    禁半个月CSDN
    半个月都不上了 伤心了 
      

  2.   

    你在 id="city" 的组件外面再套一层容器。a4j 只能刷新该容器内部的东西。
      

  3.   

    谢谢了 呵呵 
    但是当我后台的actionListener都没有被调用
    但是我用ValueChangeListener则会被调用
    但是ValueChangeListener后,第二个h:selectOneListbox提交的时候,提示非法选项,并提第二个h:selectOneListbox当onchange的时候,后台也不得到值。。