How to read the table variable from a backing bean in JSF?

1.1k Views Asked by At

I am using MyFaces Trinidad, and want to create a single page where selection in one table reloads the content of another table to match the selection.

The update is triggered by an actionListener in a partialSubmit. Then I wanted the listener in the backing bean to remember the row object of the submit, such that the getter for the value of the second table can use this as a filter.

The Trinidad documentation includes this sample, but this syntax is deprecated in JSF 1.2:

FacesContext context = FacesContext.getCurrentInstance();
MyClass selection = (MyClass)context.getVariableResolver().
    resolveVariable(context, "rowdata");

Anybody got a good suggestion?

2

There are 2 best solutions below

0
On

The JSF 1.2 way is using ELResolver. Also see the deprecation notes in the javadoc of VariableResolver. A more common JSF 1.2 alternative is the Application#evaluateExpressionGet(). Code examples can be found here.

0
On