I have a definition of header/body/footer and then extensions of that defintion for particular body JSPs.
Each "body"
jsp may need a reference to a different .js file. These references are supposed to go in the <head>, but that tag is located in the main layout definition. So, how can I include the JavaScript files I want in the <body>, when the references to the .js files have to go in the <head> ?
This solution was provided by Durgaprasad Guduguntla. Here's how you do it for a single .js file:
You can achieve this by configuring the path of the JavaScript file in the tiles definition and expose that name in the master layout. The child definitions can override the JavaScript file value and thus can render different JavaScript files within the <head> element itself.
Please take a look at the following code snippets:
tiles-defs.xml
master-layout.jsp
Here's how you'd do it for multiple js files:
tiles-defs.xml
jslayout.jsp
<< Back to
StrutsFaq