Search code examples
jsfseamrichfaceselajax4jsf

Why EL gives me the wrong object as parameter between parenthesis?


Here's the situation:

In a rich:dataTable in an a4j:form, i create a a4j:commandLink to select the values and pass it to the bean with the jboss el action syntax

action="#{bean.myaction(myparameter)}"

This works without problem.

But If I re-render the form to filter the datatable with an ajax call, when I select the value, it gives me the wrong results: the index from the selection, but the data from before the filtering.

Any ideas?

Thank you Zack for giving me the right solution in only 5 minutes.

I think passing parameter in the action between parenthesis is more elegant but, hey: this works. :)

Thank you a lot.

P.s. I'm editing the title too.


Solution

  • Try using:

    <a4j:commandLink action="#{bean.myaction}">
        <f:param name="myparameter" value="paramValue" />
    </a4j:commandLink>
    

    and then access that parameter in your action via the requestParameter("myparameter") through the FacesContext.

    As a side-note, this isn't jboss EL, it's unified expression language (EL). It's just a feature of JSP/JSF in general, as specified by Sun.