A little background first:- I'm a frontend developer who uses jDeveloper to build templates/pages. I also handle client side scripting via the use of af:clientListerner tags. But my knowledge on the backend related stuff (beans, triggers, actions) etc. is next to none. Thus, I'll be using very basic technical words to describe my problem.
Case Scenario:
Let's say I have two JSFF pages, first.jsff and second.jsff
In first.jsff, I have a command link which navigates to second.jsff. Inside this page, I have a javascript function which I need to run when the UI is rendered. But as soon as second.jsff loads up, my JS function never fires. Only when I refresh the page do I see it run. This what second.jsff looks like:
<?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" xmlns:f="http://java.sun.com/jsf/core">
<af:panelGroupLayout id="pgl17" styleClass="mainBox AFStretchWidth">
<af:resource type="javascript">
function runOnLoad(){
alert("Hello world");
}
runOnLoad();
</af:resource>
/* other ADF components go below this line
.
.
.
*/
</af:panelGroupLayout>
</jsp:root>
So I see the alert only when I refresh the page (i.e. after the redirection happens, I have to refresh the page to make the JS execute)
What am I missing here?
jDeveloper version is 11.1.1.9.0