找不到子文件夹中的Gwt静态资源 [英] Gwt static resource from subfolders not found

查看:93
本文介绍了找不到子文件夹中的Gwt静态资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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, 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆