GWT-EXT 问题 JavaScriptException: (TypeError)

本文解决了一个使用GWT(Google Web Toolkit)项目中遇到的错误,即无法加载GWT-EXT模块导致的JavaScriptException。通过在项目中添加额外的JS文件和修改HTML文件,成功解决了此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错信息:

Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @com.gwtext.client.widgets.Component::checkExtVer()([]): 无法获取未定义或 null 引用的属性“StatusBar”

at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:199)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35)
at com.gwtext.client.widgets.Component.checkExtVer(Component.java)
at com.gwtext.client.widgets.Component.<clinit>(Component.java:108)

... 12 more


我的项目: mytestgwt
MyTestGwt.gwt.xml 文件部分内容:
<module rename-to='mytestgwt'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.google.gwt.json.JSON'/>
  
  <!-- GWT-EXT    -->
  <inherits name="com.gwtext.GwtExt"/>  
  <!-- Specify the app entry point class.                         -->
  <entry-point class='com.test.client.MyTestGwt'/>

项目目录:



问题已经找到解决方法。

1.现在项目源码中  public 文件夹中添加 js/ext 文件夹,然后将  gwt-ext.zip 文件中 adapter,resources 文件夹和  ext-base.js,ext-all.js,ext-lang-zh_CN.js,uxpagingtoolbar.js,uxutil.js,exportfile.js 文件复制到 public/js/ext 目录下。
2.在项目主页面 html (我的主页 MyTestGwt.html) 文件中添加如下内容:


<div id="loading">
<div class="loading-indicator">
    <img src="mytestgwt/js/ext/resources/images/default/shared/large-loading.gif" width="32" height="32"
          style="margin-right:8px;float:left;vertical-align:top;"/>载入GWT-EXT模块JS脚本<br/>
        <span id="loading-msg">加载图片</span></div>
</div>


<!--include the Ext CSS, and use the gray theme-->
<link rel="stylesheet" type="text/css" href="mytestgwt/js/ext/resources/css/ext-all.css"/>
    
<!--include the Ext Core API-->
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = '加载核心代码...';</script>
<script type="text/javascript" src="mytestgwt/js/ext/adapter/ext/ext-base.js"></script>


<!--include Ext -->
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = '加载界面组件...';</script>
<script type="text/javascript" src="mytestgwt/js/ext/ext-all.js"></script>
<script type="text/javascript" src="mytestgwt/js/ext/ext-lang-zh_CN.js"></script>


<!--include Extend -->
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = '加载扩展组件...';</script>
<script type="text/javascript" src="mytestgwt/js/extux/uxpagingtoolbar.js"></script>
<script type="text/javascript" src="mytestgwt/js/extux/uxutil.js"></script>
<script type="text/javascript" src="mytestgwt/js/extux/exportfile.js"></script>
<!--include the application JS-->
<script type="text/javascript">document.getElementById('loading-msg').innerHTML = '加载应用组件...';</script>
    <script type="text/javascript" language="javascript" src="mytestgwt/mytestgwt.nocache.js"></script>


<!--hide loading message-->
<script type="text/javascript">Ext.get('loading').fadeOut({remove: true, duration:.25});</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值