Add custom JS libraries in JPP 6 to be used by all portlets

Solution Verified - Updated -


  • Red Hat JBoss Portal (JPP)
    • 6.x


  • How to add some custom JS libraries inside my Jboss Portal so that all my portlets would just access it ?


Below steps should be followed in order to load custom JS files at the portal level and use it in a portlet.

1) Inside portal.war (or in a portal extension's war), created a folder called js which holds the script files.


2) The hello.js is a simple script file and has following in it :

function helloWorld()
{alert("js loaded at portal level")}

3) In the /portal.war/WEB-INF/gatein-resources.xml (or in the portal extension's war), loaded the js file/s (which should be loaded at the portal level) as below :


4) Now, in the portlet's gatein-resources.xml , use the loaded javascript as :


5) On adding the portlet to a page and accessing it, it shows a pop up which signifies that script has been loaded.

If you want to load or change the default JQuery version that ships with EPP, refer

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.