Search code examples
javaxhtmlrichfaces

Richfaces: call multiple methods in s:link's action attribute


Currently I have:

action="#{A.actionA() && B.ActionB()}"

But I get the error:

Not a Valid Method Expression: #{A.actionA() && B.ActionB()}

How can I fix this?


Solution

  • AFAIK , the EL expression does not allow calling several methods in one expression.

    I suggest you can wrap these two functions to a new function and then call this new function instead.

    For example ,

    action="#{bean.onPressLink()}"
    

    And the onPressLink() will call A.actionA() and B.actionB()

    public void onPressLink(){
         //Get the managed bean called A and then call its actionA();
         //Get the managed bean called B and then call its actionB();
    }
    

    To get the managed bean by its name , you can refer to this thread.