在客户端使用带有GWT的第三方库吗? [英] Using 3rd party libraries with GWT on client side?

查看:60
本文介绍了在客户端使用带有GWT的第三方库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从GWT开始,想知道可以在客户端上使用GWT哪些库?因为GWT将Java代码转换为JavaScript,所以我真的无法想象如果您仅使用客户端就可以进行所有转换。

I'm starting out with GWT and was wondering what libraries is it possible to use with GWT on the client side? Because GWT converts Java code into JavaScript, I can't really imagine all conversions to be possible if you are just using the client side.

当然,您不想在真正的应用程序中使用客户端上的所有内容,但是我想知道转换器的物理可能性是什么?是否有任何支持的库列表?您如何知道它们是否可以转换为可与JavaScript一起使用?但是我可以想像,如果您使用Apache POI之类的东西-它不起作用,对吧?

Of course you wouldn't wanna use everything on client side in a real application, but I'm wondering what are the physical possibilities of the converter? Is there any kind of a list of supported libraries? How do you know if they can get converted to work with JavaScript? But I can imagine if you were to use something like Apache POI - it shouldn't work, right?

我想我在那里可能也缺少一些基本的了解。 。

I might be missing some basic understanding there too I guess...

推荐答案

这两个链接提供了gwt提供的jre兼容性。
http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsCompatibility.html
http://www.gwtproject.org/doc/latest /RefJreEmulation.html

These two links gives the jre compatibility provided with gwt. http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsCompatibility.html http://www.gwtproject.org/doc/latest/RefJreEmulation.html

使用其他带有gwt的库

如果您需要在gwt中使用第三方库,则需要首先将该库转换为 gwt模块
要创建gwt模块,您需要在库jar文件中放入 modeulename.gwt.xml 文件。 xml文件应包含与gwt兼容的软件包的源标记(< source path = path /> )。 (您还需要将Java源文件包含到jar中。类文件不会被编译为javascript)。

If you need to use third party libraries with gwt, you need to first convert that library into a gwt module. For creating a gwt module you need to put a modeulename.gwt.xml file in your library jar file. The xml file should contain source tag ( <source path="path" /> )to the package which needs to be gwt compatible. (You also need to include the java source files to the jar. Class files will not get compiled to javascript)

然后,您必须将模块继承到gwt项目。
为此,将< inherits name = com.yourpackage.modeulename /> 添加到您的项目gwt xml中。 (将包和模块的名称替换为库中的名称)

Then you have to inherit your module to your gwt project. For this add <inherits name="com.yourpackage.modeulename"/> to your projects gwt xml. (replace the package and module name as on your library)

现在您可以将该库编译为javascript。(请确保您的库未使用任何gwt不兼容的代码,例如外部库,不兼容的jre代码等。也可以将这些库转换为get模块)

Now you can compile the library into javascript.(Make sure that your library is not using any gwt incompatible codes like external libraries, incompatible jre codes etc. Or you can convert that libraries into get modules)

有关更多参考信息: GWT组织项目

这篇关于在客户端使用带有GWT的第三方库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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