alphadelta10
alphadelta10

Reputation: 11

Importing javascript files on WaveMaker

We have been using WaveMaker and wanted to know how we can go about importing an external javascript file using the platform ?

Upvotes: 1

Views: 340

Answers (2)

GoinOff
GoinOff

Reputation: 1802

The following works if using WaveMaker 6. This probably doesn't work with newer versions of WaveMaker.

Instead of having to add it to each project, try editing index.html in the webapproot directory and add you external js file:

<!-- Boot Wavemaker -->
<script type="text/javascript" src="config.js"></script>
<script type="text/javascript" src="/<path to javascript file>/sha512.js"></script>

Then, in order to have this work correctly in your development environment, add a context tag to server.xml just above the projects directory:

        <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">
            <Context docBase="c:/<Path To Javascript Filet" path="<path to javascript file matching whats in index.html>" reloadable="true"/>
        </Host>

In the above Context tag, docBase is the local folder with js and path should match the path placed in index.html.

Doing this you can use the javascript file across all projects without having to add it to resources in the project.

Upvotes: 0

anonuser
anonuser

Reputation: 21

  1. The external JS file should be imported into a folder in resources
  2. The file path has to be given in login.html of the Web-App
  3. The file path should be of the form "/projectname/foldername/filename.js/"
  4. The functions in the external JS file can be accessed in the login page through its script and the function invoked here is from a sample js file.

Upvotes: 2

Related Questions