JSF a4j:支持h:selectManyCheckbox [英] JSF a4j:support with h:selectManyCheckbox

查看:140
本文介绍了JSF a4j:支持h:selectManyCheckbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用JSF selectManyCheckbox和A4J支持时遇到了麻烦.目的是在选中复选框时运行某些操作.这在Firefox中非常有效.但是,当在任何IE(ie6/ie7/ie8)中进行测试时,发现正在调用该动作,但是所选值被设置为空.为了测试它,我放置了一个JSF commandButton来提交表单并检查选择的值和它的正确性.因此,问题实际上出在ajax操作中(未提交表单). 这是我的代码:

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>

其中cardListProvider.categoriesListList<SelectItem>cardListProvider.categoriesHolder.selectedCategoriesList<String>

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

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

推荐答案

您应该使用JBoss EL或声明JSF函数. 如果您使用的是facelets,这很简单:

  • 在您喜欢的类中声明public static方法
  • 在my.taglib.xml(facelets decriptor)中添加:
  • 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>
    

  • 此外,尝试将事件设置为"onselect"(或"onchange"),而不是"onclick"
  • 尝试设置即时="true"
  • 尝试删除方法参数-不需要它,因为您可以通过托管Bean的属性来访问它-即action="#{cardListProvider.findCards}"然后在findCards()中获取this.cardListProvider.categoriesHolder.selectedCategories
  • 尝试升级到Richfaces 3.3.2.SR1
  • 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
  • 这篇关于JSF a4j:支持h:selectManyCheckbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆