Hi. I want to ask where do i put my external javascript files and how to access them in the page. I have a problem with getting the relative path for my javascript files.
+1
A:
You put them wherever you want (only not inside WEB-INF
or META-INF
).
You should reference them either by a relative path, i.e. no slash in the beginning:
<script type="text/javascript" src="scripts/my.js"></script>
or you can use an absolute location getting it from the faces context:
<script src="#{facesContext.externalContext.context.contextPath}/scripts/my.js"
type="text/javascript"></script>
Bozho
2009-12-14 07:13:33
Tried the first approach and it worked. Tnx.. :D
cedric
2009-12-14 07:34:13