I would like to use a property of a form element instead of using an additional function to just return a certain value.
Current situation
XHTML file:
<h:commandLink action="#{menuBean.navigationAction(menuItem)}" ... >
Managed Bean behind it:
public function navigationAction(MenuItem entry) {
return entry.getForward();
}
Desired situation
I would like to skip the method call and directly use the property of menuItem to set the destination. Like this:
<h:commandLink action="#{menuItem.forward}" />
This does unfortunately not work, as the method cannot be found. Is it even possible to do so?
You could try this:
The
outcomeparameter takes a value expression that must resolve to a string. Theactionattribute ofh:commandLinkneeds a method expression.