GWT在页面加载后注入jQuery脚本

GWT在页面加载后注入jQuery脚本,gwt,Gwt,我有一个带有脚本文件custom.js的html页面,它是GWT的引导文件 <!DOCTYPE html> <html> <head> <!-- --> <script type="text/javascript" src="login/login.nocache.js"></script> <script type="text/javascript" src="common/js/custom

我有一个带有脚本文件custom.js的html页面,它是GWT的引导文件

<!DOCTYPE html>
<html>
<head>
    <!-- -->
    <script type="text/javascript" src="login/login.nocache.js"></script>
    <script type="text/javascript" src="common/js/custom.js"></script>
</head> 
        <div id="gwt-inject-place"/> 
</html>
这将插入custom.js,但仅显示
全局警报

public void onModuleLoad(){
  RootPanel.get("gwt-inject-place").add(view);
  ScriptInjector.fromUrl("../common/js/custom.js").inject();
}
从谷歌文档:

<script src="js-url"/>

自动注入位于src指定位置的外部JavaScript文件。有关详细信息,请参见自动资源包含

因此,必须将注入放在
module.gwt.xml

进一步资料:

<script src="js-url"/>