【问题标题】:Richfaces: call multiple methods in s:link's action attributeRichfaces:在 s:link 的 action 属性中调用多个方法
【发布时间】:2011-07-14 20:15:54
【问题描述】:

目前我有:

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

但我得到了错误:

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

我该如何解决这个问题?

【问题讨论】:

    标签: java xhtml richfaces


    【解决方案1】:

    AFAIK ,EL 表达式不允许在一个表达式中调用多个方法。

    我建议你可以将这两个函数包装成一个新函数,然后调用这个新函数。

    例如,

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

    onPressLink() 将调用 A.actionA()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();
    }
    

    要通过名称获取托管bean,可以参考这个thread

    【讨论】:

      猜你喜欢
      • 2012-07-05
      • 1970-01-01
      • 1970-01-01
      • 2016-02-29
      • 2019-05-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多