Hello,
I have a
JSP (main.jsp) with a javascript file referenced within the HTML HEAD tag. Since the javascript needs to populate certain arrays from the session bean, it is itself a JSP (js.jsp). This array population code exists outside of any function calls.
The bean caches certain properties that must be loaded from the database, such that multiple calls only go out to the database once. Both main.jsp and js.jsp need a certain property (the same one). For
testing purposes, I have added alert boxes to both code blocks.
All of this works fine, but this sequence seems surprising:
1) js.jsp alert box announces it accessed the bean property second.
2) main.jsp alert box announces it accessed the bean property first.
I expected js.jsp to alert first, running from HEAD, but i didn't expect main.jsp to get to the bean first, for the same reason.
Is the order of execution for various JSPs that contribute to the final markup specified ... e.g., embedded JSPs always run after containing JSPs?
What if there are also include-directive JSPs ... is order of execution specified simply to follow the (linear) order that embedded JSPs are encountered in the containing JSP, regardless of any enclosing semantic elements, but only after the containing JSP is run?
Thanks!