Method call activities allow to call a custom method.It invokes the method before the application render the page.This approach is better than invokeAction in the page def file.You may need to use invokeAction for the following cases
- Method needs to execute more than one phase of page's lifecycle
- Reuse the page and page def file with the method in it
- Not using adf controller
Create a managed bean in the request scope
package test.view;
public class MethodCall {
public MethodCall() {
super();
}
public String testMyReturn(String
a) {
System.out.println(" Arg
="+a);
return "Test Arg="+a;
}
}
Create a bounded task flow with the method call
Method call activity has the following
- Method using EL
- Optional Parameters with class and value
- Optional return type of the method stores in a variable.
methCall_view.jspx
<?xml
version='1.0' encoding='UTF-8'?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:panelGroupLayout
id="pgl1">
<af:outputText
value="#{pageFlowScope.testReturn}" id="ot1"/>
</af:panelGroupLayout>
</jsp:root>
Drag and
drop the task flow as a region in testMethCall.jspx and Run the page.
No comments:
Post a Comment