2 Replies Latest reply on Sep 10, 2013 11:05 AM by donino doninos

    How to share portlet headers

    donino doninos Newbie



      In the screenshot below (Gatein 3.6.final Tomcat 7 bundle),  there are 4 portlet windows:

      - 3 portlet windows to enter a parameter

      - 1 portlet window to display a BIRT report.

      - Both report and parameter applications reside in the same .WAR deployment, and they use the same javascript & css headers (same ID, same URL)

      - These headers are injected by overriding "doHeader" method, as it is recommended with Gatein




      Unfortunately, headers are injected for each portlet window, resulting in this html head section:



      Did we miss something? Is there a mechanism in Gatein  to detect which headers are shared between portlets, before generating a page?



        • 1. Re: How to share portlet headers
          Matt Wringe Master

          For portlet javascript and css files, the recommended approach is to use the gatein-resources.xml file to configure them.

          1 of 1 people found this helpful
          • 2. Re: Re: How to share portlet headers
            donino doninos Newbie

            Thank you Matt!


            After a tough fight i was able to define a shared javascript resource in gatein-resources.xml, and link it to my two portlets with a dependency. It works very well: now the javascript resource is included just one time, whatever the number of portlet windows on the page


            Though i still have troubles with css. I declared this in gatein-resources.xml:















            When i open a page containing  "myPortletReport" and "myPortletParameter" (such showed as example in the first post), it nearly works but i have two problems:

            • Images are not found by my custom css rules. These images are in a relative folder /images (so it is located in my webapp at  /resources/css/images). They were correctly taken in consideration with "doHeaders" method but not when using  a portlet-skin. It seems the portal shadows the css in a working folder, but i have not found out a way to include an image folder as well.
            • It is now including two links such below: one link with an ID myPortletReport, and another with ID myPortletParameter. Thats much better than initial situation which added 4 links, but is it possible to  change the setup to include only one link, like for javascript resources?




            Any idea?