Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
That feels good. Thanks. Here's a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!