This is a very common use case: invocation of some custom code at page load time.
Thanks to ADF Data Control capability, we can incapsulate our custom code in a method of a POJO, and finally expose this as a Data Control (it's worth reminding that it complies with JSR 227 specification, so it's actually adherent to Java standards).
As we have many flavours of bindings, we are going to show in this tutorial how to achieve the same result using an
attribute binding, and then using a
method binding.
For this tutorial JDeveloper 11.1.1.5.0 has been used.
As a first step, let's create a new
Fusion Web Application (ADF) :

In the Model project we now create a new Java class, named
PageLoadDC:

and expose this class as a Data Control:

After this, the
Data Controls panel is populated with the new item:

And the
DataControls.dcx file is updated with the following content:

Now let's work on the
ViewController project: at first we create a new
JSF page, named
home.jspx:


To make JDeveloper create the necessary bindings for you in the pageDef file for the new page, just drag & drop the method binding from the
DataControls panel onto the page, choosing
ADF Output Text as display mode for this binding:


In this way, many things happen behind the scenes:
– a new pageDef for home.jspx page is created
– a new binding for the method exposed in the data control is created
– an iterator has been defined for this binding, to access the results of this method call.

The generated code in the newly created pageDef is:

Running the application gives the expected result:

An interesting observation:
Having named the DC method with a name starting with 'get' (in this case 'getContentAtPageLoad'), this is interpreted by ADF as a getter of a property 'contentAtPageLoad', so the binding definition is really an
attribute binding rather than a pure method binding, and in the home.jspx page the following EL expression is used to retrieve the value:
#{bindings.contentAtPageLoad.inputValue}
Now we
add a new method in the DC, this time naming it in a different name, e.g. 'buildContentAtPageLoad':

and we expose the file as a DC again:

we can now notice how a method binding is actually created.
Now in the bindings box select the Plus icon to create a new binding, the select
methodAction:

In the next screen just select the DC we just created, and the method name will appear in the 'Operation' dropdown list, then press OK:

As a result, a new binding is created in the pageDef file, and it appears in the 'Bindings' box in the page overview :

Now, to make this methodAction execute when the page is loaded, we just need to create an
invokeAction to actually invoke it: in the 'Executables' panel in the 'Bindings' tab for the
home.jspx page just click the Plus icon and select InvokeAction:

In the 'InsertInvokeAction' select the 'buildContentAtPageLoad' method and assign it an arbitrary ID, then click OK:

Then select the newly created invokeActionBinding, and in the property inspector set the 'Refresh' dropdown to 'Always':

In the JSPX page set the EL expression for the new binding like that:

Running the page again we get the expected result:

Easy as a pie.
You can download the example JDeveloper project
here (remove the .pdf extension before unpacking).