is it possible to pass a method in an EL expression?
I have one bean and two views. The second view has a button but which method the button triggers should be defined by the first view. So I have to tell the second view the method whe n I link from the first view.
I imagine something like this:
First View:
<h:link outcome="secondView.xhtml" value="Second view with method A">
<f:param name="methodToCall" value="#{bean.methodA}">
</h:link>
<h:link outcome="secondView.xhtml" value="Second view with method B">
<f:param name="methodToCall" value="#{bean.methodB}">
</h:link>
Second view:
<h:commandButton action="#{methodToCall}" value="Call the method" />
I don’t think there is a way to do this in JSF. My suggestion would be to have the call from the first view select a delegate in the backing bean which is called when clicking the action from the second view.
Something like this