Here is the tutorial on how to invoke a method before the page loads in ADF. Let’s assume that you have a method in the application module, which will have to be invoked before the page load.
For this, you have to expose this method as a client method using the client interface option for the application module. Click the edit icon and you will see your method listed in the Available list. Shuttle the method to Selected list and press ‘ok’.
After shuttling the method you will see that the method gets added to the client interface.
The method that we added will be exposed to the view layer through the application module data control. You have to refresh the data control to see your method.
Now to get the binding for our method we have to add a method action binding to the page definition file and select the method that is exposed in the data control. We select our method from the Operation and click ‘ok’.
After that we have to create an invokeAction in the Executables section to invoke the method action. We select our method from the list for the Binds and select Refresh as ‘always’.

now the method action binding and the invoke action is added to the page definition file.By default the invokeAction binding is added as a last executable. But we want to invoke the action on page load, so we move the invoke action to the first place to execute initially before any other executable. This can be done by dragging the invokeAction to the first place.
Now whenever you run your page you will see the control goes to the method automatically.


download the sample project from this location
Like this:
Like Loading...