You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Ba...@Koopmanint.com on 2008/05/28 15:50:37 UTC
How to inlcude resource
Hi List,
I want to include an external JavaScript file as a resource in my Facelets
template. I added a "<script src="myLib.js"/> tag to the HTML head. When I
do this, the JSF servlet tries to interpret the .js file as a JSF page. I
guess this is why the ResourceServlet exists. The ResourceServlet is
configured on the /adf/* pattern. So i guess I'll have to add /adf/ in
front of the URL I'm refering to in my <script> tag. But two problems
arise:
When the page that uses the Facelet template is in a subdirectory, this
subdirectory is automatically added to the relative path of the <script>
tag. How can I use a path relative to the location of the template itself?
(So that I get the js library included in all pages that are based on the
template, whether they are in a subdirectory or not.)
Where do I heave to put my .js file so that it can be found by the
ResourceServlet? I tried several locations within my WAR file, but none
worked....
Thanks in advance for helping me out!
Best regards,
Bart Kummel