简体   繁体   中英

Importing javascript files on WaveMaker

我们一直在使用WaveMaker,想知道如何使用该平台导入外部javascript文件?

  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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM