我在GWT html中的javascript路径有问题.
我得到:WARNING: No file found for: /smartajax/libs/historyjs/history.html4.js以及更多类似的内容
文件存在于我的war/html1目录中.
仅当不是从我的Html1.html调用了上述脚本,而是从其他公开脚本(<script type="text/javascript" ...>
在html中未声明)调用时,才会发生这种情况 - 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, x.y/
GWT.getModuleBaseURL()-> gwt模块的基本网址, 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, x.y/
GWT.getModuleBaseURL() -> Base url for gwt module, x.y/module_name/
更多推荐
找不到子文件夹中的Gwt静态资源
发布评论