X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFm
    January 15, 2012

How-to invoke ADF bindings in page templates

Frank Nimphius
Master Principal Product Manager

ADF Faces page templates may
have their own PageDef file defined to access the ADF binding layer or have ADF
bound components added to the template.

ADF Faces pages that use the
template will reference the template's PageDef file in the Executable section of their own PageDef file. In this sample, the
template binding reference in the
the template consumer page PageDef file is ptb1.

The code below invokes a method binding in the template's PageDef file from a command button on the page. The "trick" for
accessing the template's PageDef file is to know that it is another instance of
BindingContainer.

public String cb1_action() {
  BindingContext bctx = BindingContext.getCurrent();

  DCBindingContainer bindings = (DCBindingContainer)bctx.getCurrentBindingsEntry();
  //access the page template Pagedef file reference in the
  //Executable section of the consumer page's Pagedef file

  DCBindingContainer templateBinding =
(DCBindingContainer)bindings.get("ptb1");

  //get the MethodBinding
  OperationBinding printMethod =
        (OperationBinding)templateBinding .get("printThis");
//invoke the print method exposed on the template's PageDef file
  printMethod.getParamsMap().put("message","Hello World");

  printMethod.execute();
  return null;
}
 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.