1 Reply Latest reply on Dec 12, 2007 8:24 PM by Sergey Smirnov

    can we use the build in prototype library the normal way?

    vivian hu Novice

      Currently, we use our own Prototype and Scriptaculous library. The problem is the potential conflict with our own Prototype library with the build in one. Can we use the build in one directly? In another word, use the build in one as if it is standalone without going through Rich tag or a4j?

        • 1. Re: can we use the build in prototype library the normal way
          Sergey Smirnov Master

          Sure, you can. Actually, the conflicts are possible as soon as browser do not know those are the same.
          We try to keep the version of Prototype and Scriptaculous always up to date.
          If you do not have any components that use them, you can include such library explicitly.


          <a4j:loadScript src="resource://prototype.js" />

          <a4j:loadScript src="resource://scriptaculous.js" />

          If you do not want to load the whole Scriptaculous, you can refer to the particular file, like:
          <a4j:loadScript src="resource://scriptaculous/effects.js" />

          Additional Info:

          The above strings are aliases (shortcuts).

          You can use the full name like:
          <a4j:loadScript src="resource:///org/richfaces/renderkit/html/scripts/scriptaculous/effects.js" />

          The list of aliases you can look at the /META-INF/resources-config.xml files located in richfaces-impl.xxxxx.jar

          When it might be important:
          javascript libraries extensions each other very often. The order of the libraries is important. I guess, you know it, as soon as already use them. So, if you load first library, extend it with the second one and them load the first library, but using different name - the browser load it and overwrite the extensions.

          If you use the richfaces components, some of them load the libraries omplicitly. If you load the same library explicitly after that, the problem above might be possible.

          So, if you suddenly get something like "variable is not defined", look at the page header and see for double loading. Removing the same lib (with diff path) or using the same path should help.