繁体   English   中英

JSF a4j:支持h:selectManyCheckbox

[英]JSF a4j:support with h:selectManyCheckbox

我在使用JSF selectManyCheckbox和A4J支持时遇到了麻烦。 目的是在选中复选框时运行某些操作。 这在Firefox中完美运行。 然而,当在任何IE(ie6 / ie7 / ie8)中进行测试时,发现该动作被调用但所选值被置为空。 为了测试它,我放置了一个JSF commandButton来提交表单并检查所选的值并且它是正确的。 所以问题实际上是在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.categoriesListList<SelectItem>cardListProvider.categoriesHolder.selectedCategoriesList<String>

有谁有这个问题? 谁能帮我这个? 谢谢

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

  • 在您偏好的类中声明一个public static方法
  • 在my.taglib.xml(facelets decriptor)中添加:
  • <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”
  • 尝试seting immediate =“true”
  • 尝试删除方法参数 - 您不需要它,因为您可以通过托管bean的属性访问它 - 即action="#{cardListProvider.findCards}"然后在findCards()获取this.cardListProvider.categoriesHolder.selectedCategories
  • 尝试升级到richfaces 3.3.2.SR1
  • 我很惊讶这甚至适用于Firefox。 操作方法不支持参数。 来自Richfaces文档:

    signature must match java.lang.Object action()

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

    暂无
    暂无

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM