I am trying to parametrize the action attribute of <h:commandLink> in an include file:
<ui:include src="template-file.xhtml">
<ui:param name="actionToCall" value="actionSave" />
<ui:param name="actionLabel" value="actionLabel" />
</ui:include>
Where the template-file.xhtml contains:
<h:commandLink action="#{actionToCall}" value="#{actionLabel}" />
but I am getting the following exception:
javax.el.ELException: /page.xhtml @17,45 action="#{actionToCall}":
Identity 'actionToCall' does not reference a MethodExpression instance,
returned type: java.lang.String
I want it to call the spring web flow transition action I put in the actionToCall variable.
Add a
.toStringafter the variable. This gives it a "method expression" (which it is looking for) and allows it to pass through and execute the desired call. The tag ends up looking like: