How to execute method on page load method call in ADF Faces

1. Open the page definition of your JSF Page – TestOnPageLoad.jspx

2. Add the controllerlclass in the <PageDefinition> tag as given below

<pageDefinition xmlns=””
version=”″ id=”TestOnPageLoadPageDef”
3. Create the class – executeOnPageLoadMethod which implements PagePhaseListener and override the beforePhase method.

import oracle.adf.controller.faces.context.FacesPageLifecycleContext;
import oracle.adf.controller.v2.lifecycle.Lifecycle;
import oracle.adf.controller.v2.lifecycle.PagePhaseEvent;
import oracle.adf.controller.v2.lifecycle.PagePhaseListener;

import oracle.binding.BindingContainer;

public class executeOnPageLoadMethod implements PagePhaseListener {
private BindingContainer bc = null;

public void beforePhase(PagePhaseEvent event) {
FacesPageLifecycleContext ctx =
if (event.getPhaseId() == Lifecycle.PREPARE_MODEL_ID) {
bc = ctx.getBindingContainer();
bc = null;

public void afterPhase(PagePhaseEvent event) {

public void onPageLoad() {



3. Open the Class PageLoadBackingBean and extend the class – executeOnPageLoadMethod
public class PageLoadBackingBean extends executeOnPageLoadMethod {

4. Implement the method onPageLoad in the class – PageLoadBackingBean which is defined in the class – executeOnPageLoadMethod

* Method to override the onPageLoad method of the executeOnPageLoadMethod
* which implements the PagePhaseListener Class
public void onPageLoad() {
if (!AdfFacesContext.getCurrentInstance().isPostback()) {

5. public void executeSomeMethod() {

// execute some logic here

How to execute method on page load method call in ADF Faces
Scroll to top
Copy Protected by Chetan's WP-Copyprotect.