answered
2021-01-18 10:13:59 +0800
cor3000 6280 ● 2 ● 7 I can't use this because it tries to reference the file from the test webapp
It is expected that all module resources are loaded via the webapp that includes them. The code you tried can't work for several reasons:
<script>
zk.load('utilityPackage'){ // doesn't work
....
}
</script>
Correct observation it doesn't work for several reason:
1) it's syntactically wrong, it's not even correct javascript
2) it is not following the API docs on zk.load - the zk.load
function has 2 arguments, a package name and callback function to be called when the package is loaded.
Correct syntax and api usage:
<script>
zk.load('utilityPackage', function() {
...
});
</script>
This will then load the package 'utilityPackage' using the following url inside your test webapp ...
http(s)://[yourserver]/test/zkau/web/[someid]/js/utilityPackage.wpd
... which will then try to find the corresponding zk.wpd file in your classpath under (also in your utilityModule.jar):
web/js/utility/zk.wpd
The related source location in your module project is:
src/main/resources/web/js/utility/zk.wpd
3) you placed your file into unexpected subfolders (dir1/dir2
) and the wrong file name utilityPackage.wpd
instead of zk.wpd
(we had all this covered in a your previous question ... no need to change this pattern).
src/main/resources/web/dir1/dir2/js/utilityPackage/utilityPackage.wpd
To start with you have to place it below:
src/main/resources/web/js/utilityPackage/zk.wpd
Important are the first two folders web/js
... and the name zk.wpd
.
(Again can only remind you that we offer dedicated support to help more efficiently to avoid these kind of confusion from the start.)