views:

844

answers:

3

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.

+2  A: 

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.

Zack
+1  A: 

In addition to the Zack's answer, I would say that if you need to extend the EL expressions in order to have the ability to call method with parameters, you can use the EL Functors library:

action="#{bean.myaction$[myparameter].action}"
romaintaz
He's using JBoss EL. You can do #{bean.myaction(myparameter)} just fine.
Damo
Ok, thanks for the information (I've never used JBoss EL).
romaintaz
A: 

Is your datatable populated using a Collection annotated with @DataModel ? If so try removing it from the context when filtering so that it gets re-requested.

eg.

//In filter method
Contexts.removeFromAllContexts("yourDataModelCollection");
Damo
Thanks, but I'm not using the datamodel. I'm using seam entity query framework.
volothamp