4 Replies Latest reply on Aug 24, 2009 5:45 AM by Matteo Dosmi

    Using complex JavaScript libraries in a JSF app

    Florian Marwede Expert

      Sorry, this is a little bit offtopic but I hope someone could help me:

      I would like to integrate the 'open jacob draw2d' library into a Richfaces/Tomahawk/Facelet web application. By the way with this library you can build graphical editors.

      First step: Create a small sample editor with the library - than you have only a big bundle of java scripts -, adding a index.html as container for that and open that file in a browser. That works fine for me.

      Second step: I integrate this files in my JSF-Eclipse-Project, or precisly speaking: Red Hat Developer Studio JSF project ;-). Then I use my welcome index.html as container like above. I'm doing this to avoid mixing up jsf/ajax things with my new graphical editor. At first I just want to test the integration of the editor into my normal tomcat environment.

      Now the important thing: When I deploy that in my Tomcat (5.5) the editor shows up in the browser but it don't refresh/update itself. So I see a toolbar and I can draw boxes and lines but I see not all of this. By the way there are no script errors.

      My question: Are there any config params for example in the web.xml that can affect complex javascript stuff? Or do you have another idea in which direction I have to go to solve this problem?

      Thank you!

        • 1. Re: Using complex JavaScript libraries in a JSF app
          Florian Marwede Expert

          I can answer myself: There were broken references to images deep inside the JavaScript. Now it is running.

          Perhaps I will have some other questions about embedding this editor in an richfaces web app (for example drag and drop), but for now I'm happy.

          • 2. Re: Using complex JavaScript libraries in a JSF app
            Florian Marwede Expert

            As announced here another question: The graphical editor mentioned is pure javascript, so I need a ajax connection to the server for loading and saving. It seems very easy to me to use a4j:jsFunction for that and at first glance it works.
            But are they any pitfalls I have to keep in mind or alternative ways you can suggest?

            Thank you!

            • 3. Re: Using complex JavaScript libraries in a JSF app
              Matteo Dosmi Newbie

              Hi friend,
              I'm trying in developing an application like your one.
              Using JSF RichFaces page as container of a pre-made application which uses OpenJacobDrawn2D library.
              Can you help me, better explaining how to include the cited library inside the RichFaces page ?
              My problem occurs when I import javacript using tag and the <rich:panelMenuGroup> tags seem to stop run. In fact when I click them nothing happens. On the other hand, without importing the draw2D library the JSF page behaves normally.

              I hope you can write me a running example of your application, in which you succesfully integrates JSF richface page (using different tags other than a normal <h:panelGrid>) and the Draw2D library..

              • 4. Re: Using complex JavaScript libraries in a JSF app
                Matteo Dosmi Newbie

                 

                "wingmandodo7" wrote:

                sorry I didn't find the Edit Button

                Hi friend,
                I'm trying in developing an application like your one.
                Using JSF RichFaces page as container of a pre-made application which uses OpenJacobDrawn2D library.
                Can you help me, better explaining how to include the cited library inside the RichFaces page ?
                My problem occurs when I import javacript using "script" tag and the "rich:panelMenuGroup" tags seem to stop run. In fact when I click them nothing happens. On the other hand, without importing the draw2D library the JSF page behaves normally.

                I hope you can write me a running example of your application, in which you succesfully integrates JSF richface page (using different tags other than a normal "h:panelGrid" tag) and the Draw2D library..