1

I'm working on a project where I'm using a template for all JSF pages. The <head> tag is defined in the template, so it's the same for all pages.

In this project JS is needed. I know JS files should be imported in the <head> but doing that for all JS files required by the project would be inefficient because every script would be included in every page.

I would like to know if there is a smart way to load a JS file(s) only for a(some) specific page(s) considering also that I'm using JSF 1.2 so it's not possible for me to solve this problem using <h:outputScript>.

Thanks!

avalori
  • 427
  • 2
  • 5
  • 17
  • Are you using JSP or Facelets as view technology? Since you explicitly said "template" I assume Facelets. But JSP is much more common in JSF 1.x. Just asking to be sure. – BalusC Mar 13 '12 at 18:33
  • I'm using JSP as view technology, and a [third-party tag library named Jenia](http://www.jenia.org) for templating through the '' and '' tag in the template and the specific pages respectively. – avalori Mar 14 '12 at 08:13
  • It's not possible by JSP, but by Facelets. I am not familiar with Jenia, but it look like that it could be the solution. – BalusC Mar 14 '12 at 11:15
  • I'm currently not using Facelets, anyway, I would like to know what solution you had in mind, because it could be a reason to reintroduce Faceles in the project. Thanks – avalori Mar 14 '12 at 13:17
  • 1
    With Facelets, you'd just use `` inside `` of master template and use `` in the template client to insert the ` – BalusC Mar 14 '12 at 13:21
  • Thanks for your interest, your reply is very useful! – avalori Mar 14 '12 at 13:41

0 Answers0