找不到子文件夹中的Gwt静态资源

编程入门 行业动态 更新时间:2024-10-27 14:22:35
本文介绍了找不到子文件夹中的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, 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静态资源

本文发布于:2023-11-13 10:10:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584102.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   静态   文件   夹中   资源

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!