English 中文(简体)
JSF a4j:support with h:selectManyCheckbox
原标题:

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

问题回答

You should use either JBoss EL, or declare a JSF function. If you are using facelets, this is as easy as:

  • declare a public static method in a class of your preference
  • in a my.taglib.xml (facelets decriptor) add:
  • <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>
    

  • Also, try setting the event to "onselect" (or "onchange") rather than "onclick"
  • try seting immediate="true"
  • try removing the method parameter - you don t need it, since you can access it via the property of the managed bean - i.e. action="#{cardListProvider.findCards}" and then in findCards() get this.cardListProvider.categoriesHolder.selectedCategories
  • try upgrading to richfaces 3.3.2.SR1
  • 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





    相关问题
    JSF a4j:support with h:selectManyCheckbox

    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 ...

    Mojarra for JSF Encoding

    Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

    如何拦截要求终止?

    在共同基金中,如果用户要求终止,就需要采取一些行动。 我需要某种拦截器,但我不知道如何这样做。 我需要帮助。 增 编

    ICEFaces inputFile getting the file content without upload

    Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading ...

    Weird behaviour of h:commandLink action (MethodExpression)

    I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

    How to correctly use ResultSet with h:dataTable

    The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

    热门标签