[prev in list] [next in list] [prev in thread] [next in thread] 

List:       myfaces-user
Subject:    How to inlcude resource
From:       Bart.Kummel () Koopmanint ! com
Date:       2008-05-28 13:50:37
Message-ID: OF6882BBF6.E0786B99-ONC1257457.004B7B05-C1257457.004C0BEA () koopmanint ! com
[Download RAW message or body]

This is a multipart message in MIME format.
--=_alternative 004C0BE9C1257457_=
Content-Type: text/plain; charset="US-ASCII"

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
--=_alternative 004C0BE9C1257457_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Hi List,</font>
<br>
<br><font size=2 face="sans-serif">I want to include an external JavaScript
file as a resource in my Facelets template. I added a &quot;&lt;script
src=&quot;myLib.js&quot;/&gt; 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 &lt;script&gt; tag. But two problems arise:</font>
<ul>
<li><font size=2 face="sans-serif">When the page that uses the Facelet
template is in a subdirectory, this subdirectory is automatically added
to the relative path of the &lt;script&gt; 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.)</font>
<li><font size=2 face="sans-serif">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....</font></ul>
<br><font size=2 face="sans-serif">Thanks in advance for helping me out!</font>
<br>
<br><font size=2 face="sans-serif">Best regards,</font>
<br><font size=2 face="sans-serif">Bart Kummel</font>
--=_alternative 004C0BE9C1257457_=--
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic