Why is EL giving me the wrong object as a parameter between the brackets?
Here's the situation:
In rich: dataTable in a4j form: i create a4j: commandLink to select values and pass them to bean with jboss el action syntax
action="#{bean.myaction(myparameter)}"
This works without issue.
But if I re-render the form to filter the data with an ajax call, when I select the value, it gives me wrong results: index from selection, but data before filtering.
Any ideas?
Thanks to Zach for giving me the correct solution in just 5 minutes.
I think the passing parameter in the action between the brackets is more elegant, but hey: it works. :)
Thank you very much.
Ps I am editing the title too.
a source to share
Try using:
<a4j:commandLink action="#{bean.myaction}">
<f:param name="myparameter" value="paramValue" />
</a4j:commandLink>
and then access that parameter in your action via requestParameter("myparameter")
via FacesContext
.
As a side note, this is not jboss EL, it is Unified Expression Language (EL). This is just a feature of JSP / JSF in general as pointed out by Sun.
a source to share
In addition to Zack's answer, I would say that if you need to extend EL expressions to be able to call a method with parameters, you can use the EL Functors Library :
action="#{bean.myaction$[myparameter].action}"
a source to share