[英]JSF a4j:support with h:selectManyCheckbox
I'm having trouble with a JSF selectManyCheckbox and A4J support. 我在使用JSF selectManyCheckbox和A4J支持时遇到了麻烦。 The purpose is to run some action when a checkbox is selected.
目的是在选中复选框时运行某些操作。 This works perfectly in Firefox.
这在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.
然而,当在任何IE(ie6 / ie7 / ie8)中进行测试时,发现该动作被调用但所选值被置为空。 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.
为了测试它,我放置了一个JSF commandButton来提交表单并检查所选的值并且它是正确的。 So the problem is really in the ajax action (without submiting the form).
所以问题实际上是在ajax动作中(没有提交表单)。 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>
其中
cardListProvider.categoriesList
是List<SelectItem>
而cardListProvider.categoriesHolder.selectedCategories
是List<String>
Has anyone had this problem? 有谁有这个问题? Can anyone help me with this?
谁能帮我这个? Thank you
谢谢
You should use either JBoss EL, or declare a JSF function. 您应该使用JBoss EL,或声明JSF函数。 If you are using facelets, this is as easy as:
如果您使用facelets,这很简单:
public static
method in a class of your preference public static
方法 <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
action="#{cardListProvider.findCards}"
然后在findCards()
获取this.cardListProvider.categoriesHolder.selectedCategories
I am surprised this even works in Firefox. 我很惊讶这甚至适用于Firefox。 Action methods don't support parameters.
操作方法不支持参数。 From the Richfaces docs:
来自Richfaces文档:
signature must match java.lang.Object action()
http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf?tab=info&cid=1615759 http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf?tab=info&cid=1615759
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.