JSF a4j:支持 h:selectManyCheckbox
我在 JSF selectManyCheckbox 和 A4J 支持方面遇到问题。目的是在选中复选框时运行某些操作。这在 Firefox 中完美运行。然而,在任何 IE (ie6 / ie7 / ie8) 中测试时,发现正在调用该操作,但所选值被设置为 null。为了测试它,我放置了一个 JSF 命令按钮来提交表单并检查所选的值是否正确。所以问题确实出在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.categoriesList
是 List
, cardListProvider.categoriesHolder.selectedCategories
是 List
有人遇到过这个问题吗?谁能帮我解决这个问题吗? 谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用 JBoss EL,或者声明一个 JSF 函数。
如果您使用 Facelets,这很简单:
public static
方法:
action="#{cardListProvider.findCards}"
,然后在findCards()
中获取this.cardListProvider.categoriesHolder.selectedCategories
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 preferenceaction="#{cardListProvider.findCards}"
and then infindCards()
getthis.cardListProvider.categoriesHolder.selectedCategories
我很惊讶这甚至可以在 Firefox 中运行。操作方法不支持参数。来自 Richfaces 文档:
签名必须匹配 java.lang.Object action()
http://livedemo.exadel.com/richfaces-demo/richfaces/support.jsf?tab=info&cid=1615759
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