JSF a4j:支持 h:selectManyCheckbox

发布于 2024-08-10 23:48:42 字数 1086 浏览 4 评论 0原文

我在 JSF selectManyCheckbox 和 A4J 支持方面遇到问题。目的是在选中复选框时运行某些操作。这在 Firefox 中完美运行。然而,在任何 IE (ie6 / ie7 / ie8) 中测试时,发现正在调用该操作,但所选值被设置为 null。为了测试它,我放置了一个 JSF 命令按钮来提交表单并检查所选的值是否正确。所以问题确实出在ajax操作上(没有提交表单)。 这是我的代码:

        <h:selectManyCheckbox id="supportCategoryCardFilter" value="#{cardListProvider.categoriesHolder.selectedCategories}"  layout="pageDirection" required="false" >
            <f:selectItems value="#{cardListProvider.categoriesList}" />
            <a:support ajaxSingle="true" status="statusSearchCard" id="supportCategoryCardFilter2" event="onclick" reRender="cardsHolder, renderCardsCategoriesPanel" 
                 action="#{cardListProvider.findCards(cardListProvider.categoriesHolder.selectedCategories)}"  >
            </a:support>
        </h:selectManyCheckbox>

其中 cardListProvider.categoriesListListcardListProvider.categoriesHolder.selectedCategoriesList;

有人遇到过这个问题吗?谁能帮我解决这个问题吗? 谢谢

I'm having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 / ie8), found out that the action was being called but the selected value was put to null. Just to test it, I placed a JSF commandButton to submit the form and to check the value that was selected and it was correct. So the problem is really in the ajax action (without submiting the form).
Here is my code:

        <h:selectManyCheckbox id="supportCategoryCardFilter" value="#{cardListProvider.categoriesHolder.selectedCategories}"  layout="pageDirection" required="false" >
            <f:selectItems value="#{cardListProvider.categoriesList}" />
            <a:support ajaxSingle="true" status="statusSearchCard" id="supportCategoryCardFilter2" event="onclick" reRender="cardsHolder, renderCardsCategoriesPanel" 
                 action="#{cardListProvider.findCards(cardListProvider.categoriesHolder.selectedCategories)}"  >
            </a:support>
        </h:selectManyCheckbox>

where cardListProvider.categoriesList is a List<SelectItem> and cardListProvider.categoriesHolder.selectedCategories is a List<String>

Has anyone had this problem? Can anyone help me with this?
Thank you

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

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

发布评论

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

评论(2

煞人兵器 2024-08-17 23:48:42

您应该使用 JBoss EL,或者声明一个 JSF 函数。
如果您使用 Facelets,这很简单:

  • 您喜欢的类中声明一个 public static 方法
  • 在 my.taglib.xml(facelets 描述符)中添加
  • <function>
        <function-name>concat</function-name>
        <function-class>com.mycompany.myproject.ServiceFunctions</function-class>
        <function-signature>java.lang.String concat(java.lang.String, java.lang.String)   </function-signature>
    </function>
    

  • 另外,尝试将事件设置为“onselect”(或“onchange”)而不是“onclick”
  • 尝试设置immediate =“true”
  • 尝试删除方法参数 - 您不需要它,因为您可以通过属性访问它托管 bean - 即 action="#{cardListProvider.findCards}" ,然后在 findCards() 中获取 this.cardListProvider.categoriesHolder.selectedCategories
  • 尝试升级到richfaces 3.3.2.SR1
  • You should use either JBoss EL, or declare a JSF function.
    If you are using facelets, this is as easy as:

  • declare a public static method in a class of your preference
  • in a my.taglib.xml (facelets decriptor) add:
  • <function>
        <function-name>concat</function-name>
        <function-class>com.mycompany.myproject.ServiceFunctions</function-class>
        <function-signature>java.lang.String concat(java.lang.String, java.lang.String)   </function-signature>
    </function>
    
  • Also, try setting the event to "onselect" (or "onchange") rather than "onclick"
  • try seting immediate="true"
  • try removing the method parameter - you don't need it, since you can access it via the property of the managed bean - i.e. action="#{cardListProvider.findCards}" and then in findCards() get this.cardListProvider.categoriesHolder.selectedCategories
  • try upgrading to richfaces 3.3.2.SR1
  • 想挽留 2024-08-17 23:48:42

    我很惊讶这甚至可以在 Firefox 中运行。操作方法不支持参数。来自 Richfaces 文档:

    签名必须匹配 java.lang.Object action()

    http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf?tab=info&cid=1615759

    I am surprised this even works in Firefox. Action methods don't support parameters. From the Richfaces docs:

    signature must match java.lang.Object action()

    http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf?tab=info&cid=1615759

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