How to read the table variable from a backing bean in JSF?
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 depreca开发者_StackOverflow中文版ted in JSF 1.2:
FacesContext context = FacesContext.getCurrentInstance();
MyClass selection = (MyClass)context.getVariableResolver().
resolveVariable(context, "rowdata");
Anybody got a good suggestion?
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.
You may find this post helpful: http://ocpsoft.com/java/jsf-java/jsfs-hdatatable-vs-uirepeat-how-to-get-the-selected-row/
精彩评论