Search code examples
jsficefacesicefaces-1.8

Icefaces/JSF method call with arguments


I'm using Icefaces 1.8.2 and I need to do a method call with arguments on the xhtml page for which I have no idea how to do it. My web page looks like below

<ice:commandLink actionListener="#{myBean.reset}">

MyBean looks like below

protected void reset(ActionEvent event, List myList) {
.....
}

Solution

  • If you are using jsf >= 2.0:

    <ice:commandLink actionListener="#{myBean.reset(myList)}">
    

    If you just want to empty your List you can do:

    <ice:commandLink>
        <f:setPropertyActionListener target="#{myBean.myList}" value="#{null}" />
    </ice:commandLink>
    

    And in your manageBean you can do something like this:

    getMyList(){ 
        return myList == null ? new ArrayList() ? myList;
    }
    

    If not you can check some alternatives here.