JBoss Community Archive (Read Only)

GateIn Portal 3.8

Old style HTML Scripts

Whenever possible, GateIn Modules (GMD) should be used. This is the best practice as it helps to manage dependencies, organize code, not pollute the global scope and it enables the parallel loading of resources.

However relying solely on GMD it is not always possible, for example when an existing portlet uses an inline script that accesses the global namespace to find functions or objects. For such situations, GateIn Portal offers old style scripts present in the head section of a web page. Such scripts need to be declared in gatein-resources.xml file as follows:

<scripts>
  <name>foo</name>
  <script>
    <path>/path/to/foo.js</path>
  </script>
  <depends>
    <scripts>bar</scripts>
  <depends>
</scripts>

Note that:

Note that it is also possible to use a script served from other domain (e.g. from a CDN). To achieve this, the url element needs to be used instead of the script element:

<scripts>
  <name>foo</name>
  <url>http://path.to/foo.js</url>
</scripts>
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 13:20:44 UTC, last content change 2014-05-09 07:45:20 UTC.