找不到子文件夹中的Gwt静态资源 [英] Gwt static resource from subfolders not found
问题描述
我在GWT
html中的javascript路径有问题.
我得到:WARNING: No file found for: /smartajax/libs/historyjs/history.html4.js
以及更多类似的内容
文件存在于我的war/html1
目录中.
仅当不是从我的Html1.html调用了上述脚本,而是从其他公开脚本(<script type="text/javascript" ...>
- public_res
- smartajax
- libs
- historyjs
- war
- html1
- smartajax
- libs
- historyjs
<script type="text/javascript" src="html1/smartajax/load.smartajax.js"></script>
如何解决这个问题?
您的gwt公共资源文件夹被编译到模块的文件夹中,而不是war base目录中.它将被编译为war/module_name/html1/smartajax/...因此,不是使用相对uri,而是绝对uris?
GWT.getHostPageBaseURL()-> html页面的基本URL, http://x.y/
GWT.getModuleBaseURL()-> gwt模块的基本网址, http://xy/module_name/ >
I have a problem with path to javascript in my GWT
html.
I get: WARNING: No file found for: /smartajax/libs/historyjs/history.html4.js
and more like this
File exists in my war/html1
dir.
It happens only if script like this above is called not from my Html1.html, but from other script that is in public (its not declared in html by <script type="text/javascript" ...>
- public_res
- smartajax
- libs
- historyjs
- war
- html1
- smartajax
- libs
- historyjs
<script type="text/javascript" src="html1/smartajax/load.smartajax.js"></script>
How to solve this?
Your gwt public resource folder is compiled into your module's folder, and not war base directory. It will be compiled into war/module_name/html1/smartajax/... So, instead of using relative uris, how about absolute uris?
GWT.getHostPageBaseURL() -> Base url for html page, http://x.y/
GWT.getModuleBaseURL() -> Base url for gwt module, http://x.y/module_name/
这篇关于找不到子文件夹中的Gwt静态资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!