[英]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.categoriesList
是List<SelectItem>
而cardListProvider.categoriesHolder.selectedCategories
是List<String>
有誰有這個問題? 誰能幫我這個? 謝謝
您應該使用JBoss EL,或聲明JSF函數。 如果您使用facelets,這很簡單:
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}"
然后在findCards()
獲取this.cardListProvider.categoriesHolder.selectedCategories
我很驚訝這甚至適用於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.