8 Replies Latest reply on Nov 27, 2010 10:53 AM by Julien Deruère

    Integrate Dojo

    Julien Deruère Newbie



      I try to integrate Dojo's widget in my portlet but, Dojo needs be declare like this :


      <script type="text/javascript" src="../../_static/js/dojo/dojo.js" djConfig="parseOnLoad: true">


      The problem come from the djConfig attribute.


      Because in gateIn-resources I declare it like this :




      but it's not parse because of the missing of the attribute djConfig.


      How to work with Dojo?



        • 1. Re: Integrate Dojo
          Trong Tran Master

          The definition in the gateIn-resources.xml does not support such thing for you.


          But absolutely there is another way to do that by using the "Setting Markup Head Element" feature in JSR-286. That is in your portlet's rendering, you could have something like following to add the head HTML script element :


                Element script = response.createElement("script");
                script.setAttribute("type", "text/javascript");
                script.setAttribute("src", "../../_static/js/dojo/dojo.js");
                script.setAttribute("djConfig", "parseOnLoad: true");
                response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, script);


          Let me know if it works for you

          • 2. Re: Integrate Dojo
            Julien Deruère Newbie

            Yes it works, thank you.


            But, it's not a "good" solution, because I will have to do this in each portlet. If I could change the portal template, it will be better...


            Thanks for the tip

            • 3. Re: Integrate Dojo
              Trong Tran Master

              Yes, the changing of portal template may be a better solution in your case now but be careful when you upgrade to a new GateIn version later. So it's not really good solution neither in my opinion


              BTW, you could address a JIRA issue for support the attributes definition for the HTML script tag in gatein-resources.xml if you expect it

              • 4. Re: Integrate Dojo
                Julien Deruère Newbie

                I just want to add that I have an init.jsp file and all my portlet include it.


                In there is :


                <script type="text/javascript">

                var theme = 'soria';
                if(!dojo.hasClass(dojo.body(),theme)) {


                But when there are many portlets on the page, this script is execute many times and I'm not sure that's good. I feel like sometimes it's slow.

                Is there no solution for  integrating Dojo!!

                • 5. Re: Integrate Dojo
                  Trong Tran Master

                  In your case, there is a simple solution is to use a flag variable to check whether the script will be executed or not.

                  • 6. Re: Integrate Dojo
                    Julien Deruère Newbie

                    Hi, my problem isn't finished yet, It used to work but now I run the portal with "./gateIn run" and the portal generate a merged.js, and now I have lot's of javascript error with exo portal javascript (with menu, button etc). When I run with Eclipse, all js file where separate, with the merged.js it doesn't work at all!!!


                    I don't understand why?!

                    • 7. Re: Integrate Dojo
                      Trong Tran Master

                      I do not perfectly understand your use case, so it's hard to imagine what problem you are having.


                      Basically when you start GateIn, you can set the variable -Dexo.product.developing=[ true | false ] to specify whether all js files configured in gatein-resources.xml are merged into one or not

                      • 8. Re: Integrate Dojo
                        Julien Deruère Newbie

                        Yes, I just discover that! Under eclipse I used to run with -Dexo.product.developing=true and it worked fine.


                        In gatein.bat it's -Dexo.product.developing=false and GateIn merge all the JS files declare in gatein-resource.xml, and it doesn't work with Dojo...

                        But I will let the parameter to "true"