Hey there, today we are going to look at some javascript implementation in OA Framework and as the title of the post suggests we will see that how can we refresh an OA Framework page using javascript.
Assumptions:
1. You already have an OA Framework page (XXTrialPG).
2. You have a controller (XXTrialCO) attached to XXTrialPG.
3. You want the OA Framework page to refresh in every 20 seconds.
4. You have imported all the required regions and/or items in XXTrialCO.
Let’s take this in steps for easy remembrance.
Step1. Create a handle for OABodyBean
OABodyBean bodyBean = (OABodyBean) pagecontext.getRootWebBean();
Step2. Create a variable of String type and assign the below mentioned javascript code to the string variable.
String javaS = “javascript:setTimeout(‘window.location.reload()’,20000)”;
Note: Here 20000 means 20 seconds mentioned in milliseconds
Step3. Set the String variable on the onLoad() method of OABody bean, this will ensure that when the OA Framework page is rendered, the corresponding javascript code is triggered
bodyBean.setOnLoad(javaS);
That’s it Folks.
Thanks for reading.
Till the next post
Take Care