问题
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
回答1:
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}"
and then in findCards()
get this.cardListProvider.categoriesHolder.selectedCategories
回答2:
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
来源:https://stackoverflow.com/questions/1743690/jsf-a4jsupport-with-hselectmanycheckbox