没有源代码可用于java.text.SimpleDateFormat类型:GWT编译错误 [英] No Source Code is available for type java.text.SimpleDateFormat: GWT Compilation Error

查看:99
本文介绍了没有源代码可用于java.text.SimpleDateFormat类型:GWT编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图制作一个GWT应用程序。然后,我在 客户端和共享端 中使用SimpleDateFormat类时遇到了一些错误。

  [ERROR] [gwtfirst]第381行:没有源代码可用于java.text.SimpleDateFormat类型;你忘了继承一个必需的模块吗? 

以下是我在客户端的代码:

  SimpleDateFormat sdf = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss); 
Window.alert(sdf.format(usersList.get(30).getCreatedate()));

但是我可以在服务器端使用SimpleDateFormat ...
我想知道如果我在客户端或共享端不能使用SimpleDateFormat?

解决方案

SimpleDateFormat 在GWT中不可用。使用 com.google.gwt.i18n.client.DateTimeFormat 相反。


I was trying to make a GWT application. Then I got some errors when using SimpleDateFormat class in client and shared side.

[ERROR] [gwtfirst] Line 381: No source code is available for type java.text.SimpleDateFormat; did you forget to inherit a required module?

following is my code in client side:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
Window.alert(sdf.format(usersList.get(30).getCreatedate()));

But I can use SimpleDateFormat with server side... I'm wondering if I can't use SimpleDateFormat in client or shared side?

解决方案

SimpleDateFormat is not available in GWT. Use com.google.gwt.i18n.client.DateTimeFormat instead.

这篇关于没有源代码可用于java.text.SimpleDateFormat类型:GWT编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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