Dynamic Action in JSF page

后端 未结 1 685
野的像风
野的像风 2020-12-19 13:23

I have a JSF page. My CommandButton action method value is dependent on the bean variable value. Example: Bean headerBean has varaible actionValue with value \"someBean.doAc

1条回答
  •  悲&欢浪女
    2020-12-19 14:06

    You can use the brace notation for that.

    
    

    When the #{headerBean.actionValue} returns a String of for example doAction1, then this will effectively invoke #{someBean.doAction1}.

    If the bean name to be called is currently actually in the actionvalue (headerBean.actionValue returning someBean.doAction1), you need to split it into a field that returns the bean name and one that returns the method name and then use

    
    

    If headerBean.beanName returns 'someBean' and headerBean.actionValue returns doAction1 the above will call #{somebean.doAction1}.

    0 讨论(0)
提交回复
热议问题