How to execute the method that is added into the AMX page bindings section from the Managed bean.

  1. We have a method “updatePocEmpView1” added in the AMX page bindings section and want to execute it from the Managed bean. We need to use the below code –

AdfELContext adfELContext = AdfmfJavaUtilities.getAdfELContext();

MethodExpression me = AdfmfJavaUtilities.getMethodExpression(“#{bindings.updatePocEmpView1.execute}”, Object.class, new Class[] {});

me.invoke(adfELContext, new Object[] {});

2. We can execute the method in other way as below using the “AdfmfJavaUtilities.invokeDataControlMethod”, but in this case the method “loadEmpData” need not add to the AMX page bindings section. The “RetrieveEMPData” is the Data control name under the DataControl section.

//If we need to pass any input parameters to the ‘RetrieveEMPData‘ method, we need to set the values as below. If no parameters then we can pass it as null.

InputSearchParam SearchParamObj= new InputSearchParam();
List pnames = new ArrayList();
List params = new ArrayList();
List ptypes = new ArrayList();

pnames.add(“inputSearchParamObj”);
ptypes.add(InputSearchParam.class);
params.add(inputSearchParamObj);

try {

AdfmfJavaUtilities.invokeDataControlMethod(“RetrieveEMPData“, null, “loadEmpData“, pnames, params, ptypes);

} catch (AdfInvocationException ex) {

if (AdfInvocationException.CATEGORY_WEBSERVICE.compareTo(ex.getErrorCategory()) == 0) { throw new RuntimeException(“Error with the server.  Please try later.”);
}

}

This entry was posted in ADF Mobile and tagged , , , . Bookmark the permalink.

Leave a comment