Maybe it’s me stupid, but I was looking for this for quite long and finally figured out how to. So I thought it could save someone’s time too.

Say we have a JSPX page bound to a ViewObject. Also there’s a backing bean for this page. What we want is to access from the backing bean a binding defined in the page definition.

So, there’s the faces-config.xml file in public_html/WEB-INF directory of ViewController project in where we define managed beans. A declaration of a managed bean called “testBean” pointing to the class com.datamoil.view.backing.Test with request scope would look like:

<managed-bean>
<managed-bean-name>testBean</managed-bean-name>
<managed-bean-class>com.datamoil.view.backing.Test</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

pretty simple, isn’t it? After this, the fields of that class can be accessed via EL expressions. Managed bean’s properties can be used from anywhere within the project using expression like #{testBean.<propertyName>}.

But to be able to use the bindings in the bean, there’s just another thing that must be done. Two things to be precise.

First, the managed bean declaration in faces-config.xml must include a managed-property element.

<managed-bean>
<managed-bean-name>testBean</managed-bean-name>
<managed-bean-class>com.datamoil.view.backing.Test</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bindings</property-name>
<value>#{bindings}</value>
</managed-property>

</managed-bean>

Simple! This allows the bean to access the #{bindings} .

Second, it’s only left to create a field in the bean Java class.

//the field itself
oracle.binding.BindingContainer bindings;
//and its accessors
public void setBindings(oracle.binding.BindingContainer bindings) {
this.bindings = bindings;
}
public oracle.binding.BindingContainer getBindings() {
return bindings;
}

Amazingly simple as well. That’s pretty much it. Now thingies from the page definition can be accessed using Java code.

To e.g. get an Iterator called TestView1Iterator the code would be

oracle.jbo.uicli.binding.JUIteratorBinding testViewIter = (oracle.jbo.uicli.binding.JUIteratorBinding) this.bindings.get("TestView1Iterator");

or to get an Action called TestAction

oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding testAction = (oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding) this.bindings.get("TestAction");

Wonderful isn’t it? Just keep in mind that a binding is always looked up by its name/id, meaning there’s no guarantee one will be found. So in case there’s nothing under that name in the page definition, a NullPointerException will be thrown.

By using the bindings in managed beans application gets countless possibilities in functionality. For me at least, it was the greatest obstacle to start actually using ADF. I hope this helps! There’s also another way to access bindings, but be it another article about that way.