GWT - 你忘了继承一个必需的模块吗? [英] GWT - did you forget to inherit a required module?
问题描述
在我的 GWT应用程序中,在客户端Java文件中,我写了一行来打印Locale:
In my GWT application, on the client side Java file, I have written a line to print the Locale:
System.out.println(Locale.getDefault());
这里Locale是java.util.Locale的一个实例。
Here Locale is an instance of java.util.Locale.
我收到一个异常: 09:31:53.656 [错误] [stockwatcher]第167行没有源代码可用于java.util.Locale类型;你忘了继承一个必需的模块吗?
令人惊讶的是,在这个类中我还使用了 java.util .ArrayList
和 java.util.Date
但我没有得到这些类的任何异常。
Surprisingly, in this class I've also used java.util.ArrayList
and java.util.Date
but I did not get any exception for those classes.
我在这里做错了什么?
推荐答案
GWT的一方无法访问整个Java API。 Java.util.Locale就是其中之一。您不能在客户端使用甚至导入它。但是你一定可以在GWT的服务器端使用它。您可以在客户端此处。
The client-side of GWT does not have access to the whole Java API. Java.util.Locale is one of them. You can't use or even import it on the client-side. But you can definitely use it on the server-side of GWT. You can find the list of classes that can be used at client-side here.
这篇关于GWT - 你忘了继承一个必需的模块吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!