Oracle ADF Basics: Getting values of the selected row in an af:table
Here is another kind of basic thing that you would like with ADF Faces but that just isn't very intuitive. Imagine you have JSF page and you just drag-and-dropped a View Object at it as a selectable Read-Only table. Now when the 'Select' button, that is added automatically, is clicked you want to do something with the selected row in a backing bean (I assume here that you didn't automagically bind all items on the page to a backing bean, at page creation time). So you double click at the 'Select' button in the page in Design mode. A helpful wizard starts which lets you bind the action of the button to a method in a backing bean:
![]()
So now we can implement the code in the backing bean. But wait, how are we going to get the selected row in the backing bean?
The first part can be considered quite standard for a JSF developer: Bind the AF:Table component to the backing bean so you can access the component in the backing bean, like this:
![]()
And in your bean you will have:
-
private CoreTable employeeTable;
-
-
public void setEmployeeTable(CoreTable employeeTable)
-
{
-
this.employeeTable = employeeTable;
-
}
-
-
public CoreTable getEmployeeTable()
-
{
-
return employeeTable;
-
}
But then comes the less intuitive part. To get the selected row you have to go through the JUCtrlValueBindingRef like this:
The fact that you have to cast the selected row to a JUCtrlValueBindingRef is something that can take a long time to find it out by yourself, so therefore this post :-)
Tags: JSF, Oracle JHeadstart










Is this possible for a multiselect table to get all the selected rows
Yes, it's described here:http://www.pascalalma.net/2008/04/19/oracle-adf-basics-getting-values-of-the-multiselected-rows-in-an-aftable/
But you have already discovered that, I think ;-)
Congrats so far! great tip!
I took a long time to find this info....