簡體   English   中英

JSF a4j:支持h:selectManyCheckbox

[英]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.categoriesListList<SelectItem>cardListProvider.categoriesHolder.selectedCategoriesList<String>

有誰有這個問題? 誰能幫我這個? 謝謝

您應該使用JBoss EL,或聲明JSF函數。 如果您使用facelets,這很簡單:

  • 在您偏好的類中聲明一個public static方法
  • 在my.taglib.xml(facelets decriptor)中添加:
  • <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>
    

  • 另外,嘗試將事件設置為“onselect”(或“onchange”)而不是“onclick”
  • 嘗試seting immediate =“true”
  • 嘗試刪除方法參數 - 您不需要它,因為您可以通過托管bean的屬性訪問它 - 即action="#{cardListProvider.findCards}"然后在findCards()獲取this.cardListProvider.categoriesHolder.selectedCategories
  • 嘗試升級到richfaces 3.3.2.SR1
  • 我很驚訝這甚至適用於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.

     
    粵ICP備18138465號  © 2020-2024 STACKOOM.COM