JSF a4j:支持h:selectManyCheckbox [英] JSF a4j:support with 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.categoriesList
是List<SelectItem>
,cardListProvider.categoriesHolder.selectedCategories
是List<String>
有人遇到过这个问题吗?谁能帮我这个? 谢谢
Has anyone had this problem? Can anyone help me with this? Thank you
推荐答案
您应该使用JBoss EL或声明JSF函数. 如果您使用的是facelets,这很简单:
public static
方法You should use either JBoss EL, or declare a JSF function. If you are using facelets, this is as easy as:
public static
method in a class of your preference<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>
action="#{cardListProvider.findCards}"
然后在findCards()
中获取this.cardListProvider.categoriesHolder.selectedCategories
action="#{cardListProvider.findCards}"
and then in findCards()
get this.cardListProvider.categoriesHolder.selectedCategories
这篇关于JSF a4j:支持h:selectManyCheckbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!