Wednesday 9 January 2013

Calling Javascript method using java in ADF

While working in my project I came to a situation in which I have to make a call to a JavaScript method, on load of the page. The JavaScript method was taking a parameter as an input and the value of the parameter has to come from java class.

Let's find the solution in the below example : 

1.  Create a sample jsff page and write a JavaScript method inside it. E.g "homeLoad.jsff" containing a JavaScript method as "myMethod(args)"




2. Create a Class and Java method such as "onLoadOfPage()", which will contain the code to call a JavaScript method and passing a parameter.



3. Create a taskflow such as "myTF.xml" and use Java method as default activity and jsff as an outcome.



4. Now, finally create a jspx page as "Home.jspx" and use taskflow as a region. Run the page.

Output :







*Comments and feedback are most welcomed, Thanks.