ice:selectOneMenu 发送错误的值

发布于 2024-08-01 18:24:57 字数 1476 浏览 4 评论 0原文

我的 JSF/ICEFaces 应用程序有多个下拉菜单,这些菜单相互更新,因此根据其中一个的选择,其他菜单的内容也会更新。

问题是菜单发送了错误的值。 看起来它发送的是之前的值而不是当前的值! 不知道为什么!

有任何想法吗?

谢谢,

  <td>
    <ice:selectOneMenu id="selectCurApplNm"
      value="#{statsDisplayAndFilter.applIDFilterPhrase}"
      disabled="#{statsDisplayAndFilter.disableCurrentApplIdNamesMenu}"
      valueChangeListener="#{statsDisplayAndFilter.fetchEventNames}"
      partialSubmit="true" immediate="true">
      <f:selectItem itemValue="" itemLabel="" />
      <f:selectItem itemValue="all" itemLabel="all" />
      <f:selectItems id="selectCurApplNmItems"
        value="#{statsDisplayAndFilter.currentApplIdItems}" />
    </ice:selectOneMenu>
  </td>
</tr>
<tr>
  <td>
    <ice:outputLabel for="SlctCompTyp" value="Event Name: " />
  </td>
  <td>
    <ice:selectOneMenu id="SlctCompTyp"
      value="#{statsDisplayAndFilter.eventNameFilterPhrase}"
      disabled="#{statsDisplayAndFilter.disableEventNamesMenu}"
      valueChangeListener="#{statsDisplayAndFilter.fetchMethodNames}"
      partialSubmit="true" immediate="true">
      <f:selectItem itemValue="" itemLabel="" />
      <f:selectItem itemValue="all" itemLabel="all" />
      <f:selectItems id="SlctcompTypeItms"
        value="#{statsDisplayAndFilter.eventNameItems}" />
    </ice:selectOneMenu>
  </td>
</tr>

I have multiple drop down menus with my JSF/ICEFaces application that update each others so depending on the selection of one the contents of others update.

The problem is that the menu is sending the wrong value. It seems it sends the value before instead of the current one! not sure why!

Any ideas?

Thanks,

Tam

  <td>
    <ice:selectOneMenu id="selectCurApplNm"
      value="#{statsDisplayAndFilter.applIDFilterPhrase}"
      disabled="#{statsDisplayAndFilter.disableCurrentApplIdNamesMenu}"
      valueChangeListener="#{statsDisplayAndFilter.fetchEventNames}"
      partialSubmit="true" immediate="true">
      <f:selectItem itemValue="" itemLabel="" />
      <f:selectItem itemValue="all" itemLabel="all" />
      <f:selectItems id="selectCurApplNmItems"
        value="#{statsDisplayAndFilter.currentApplIdItems}" />
    </ice:selectOneMenu>
  </td>
</tr>
<tr>
  <td>
    <ice:outputLabel for="SlctCompTyp" value="Event Name: " />
  </td>
  <td>
    <ice:selectOneMenu id="SlctCompTyp"
      value="#{statsDisplayAndFilter.eventNameFilterPhrase}"
      disabled="#{statsDisplayAndFilter.disableEventNamesMenu}"
      valueChangeListener="#{statsDisplayAndFilter.fetchMethodNames}"
      partialSubmit="true" immediate="true">
      <f:selectItem itemValue="" itemLabel="" />
      <f:selectItem itemValue="all" itemLabel="all" />
      <f:selectItems id="SlctcompTypeItms"
        value="#{statsDisplayAndFilter.eventNameItems}" />
    </ice:selectOneMenu>
  </td>
</tr>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

城歌 2024-08-08 18:24:57

我发现当它调用 valueChangeListener 中定义的方法时,该值尚未绑定到正确的变量,因此我必须使用事件变量来获取新值:

public void fetchEventNames(ValueChangeEvent e) throws SQLException{
   String filteringOptions = ""; 
   String newSelectedValue = e.getNewValue().toString();
       .....

这解决了问题

I found out that by the time it calls the method defined in valueChangeListener the value is not yet binded to the proper variable so I had to use the event variable to get the new value:

public void fetchEventNames(ValueChangeEvent e) throws SQLException{
   String filteringOptions = ""; 
   String newSelectedValue = e.getNewValue().toString();
       .....

And this solved the problem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文