Hello,
I have implemented PagePhaseListener and Following is the beforePhase() method.
public void beforePhase(PagePhaseEvent pagePhaseEvent) {
if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_MODEL_ID) {
if (!isPostback()) {
System.out.println("beforePhase() is called.");
}
}
}
private boolean isPostback() {
FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp =
elFactory.createValueExpression(elContext, "#{adfFacesContext.postback}", Object.class);
return Boolean.TRUE.equals(valueExp.getValue(elContext));
}
but on page load I got this output in console.
beforePhase() is called.
beforePhase() is called.
as it is called twice.
I checked that I have not declared context parameter for faces-config.xml in deployment descriptor.
I have also checked by removing the af:resources which includes resource files in order to check absolute path problem but still beforePhase() is called twice.
I am using jDeveloper 11g.
Please advice on the same.
Thanks.