This content has been marked as final.
Show 2 replies
-
1. Re: How-To add javascript libraries to a portlet view.
mholzner Mar 3, 2006 3:51 PM (in response to kjc5664)the easiest way (I believe) is to use the declarative injection of header content. In this case you can declare the js file to be included as link in the head tag, by adding this to your jboss-portlet.xml descriptor :
<portlet> <portlet-name>MyAJAXPortlet</portlet-name> <header-content> <link type="text/javascript" href="/portlet-resources/dojo.js" /> </header-content> </portlet>
The only limitation is that you need to use the 'generic' layout , or any other layout that features the <p:headerContent /> jsp tag -
2. Re: How-To add javascript libraries to a portlet view.
aron.gombas Mar 4, 2006 1:06 AM (in response to kjc5664)"mholzner" wrote:
the easiest way (I believe) is to use the declarative injection of header content.
I'd not suggest this, as it wouldn't be portable.
I think the problem with your original approach is that URL's are probably wrong.
This one is working for me perfectly in Kosmos:<script src="<c:url value="/pages/scripts/scriptaculous/prototype.js"/>" language="javascript"></script>
An easy test that you can do is to use a JSP @include to include the JS. If you can see its content in the browser when checking the page source, then the URL is fine.