【问题标题】:jsf cascading drop down by using ajax not workingjsf级联下拉使用ajax不起作用
【发布时间】:2013-12-06 13:07:55
【问题描述】:

我正在尝试在 JSF 中实现级联下拉。列出我在下面做的事情请帮助我

XHTML 代码:

<h:selectOneMenu value="#{bean.country_id}" id="countries">
        <f:selectItem itemLabel="-- Select a Country -- " itemValue="0"/>  
        <f:selectItems value="#{bean.countries}" var="country" id="countryList"/>
         <f:ajax event="change" listener="#{bean.getCityList}" execute="countries" render="cityList" />
</h:selectOneMenu>  

<h:selectOneMenu value="#{bean.city_id}" id="cities">
        <f:selectItem itemLabel="-- Select a City -- " itemValue="0"/>    
        <f:selectItems value="#{bean.cities}" var="city" id="cityList" />
 </h:selectOneMenu>

一旦我们更改国家/地区,调用将转到 getCityList,并且我们也在该方法中获取国家/地区值,但 getcitylist 中返回的列表未应用于 cityList,xhtml 抛出错误。

请在这方面帮助我

谢谢 KK

【问题讨论】:

    标签: ajax jsf-2


    【解决方案1】:

    f:ajax 中使用render="cities"。您必须重新渲染整个 selectOneMenu 才能在视图中看到更新后的列表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-22
      • 1970-01-01
      • 1970-01-01
      • 2016-12-24
      • 2022-07-28
      • 2018-10-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多