如何从外部库共享bean到GWT客户端? [英] How can share bean from external library to GWT client?

查看:77
本文介绍了如何从外部库共享bean到GWT客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于将库中的java bean共享给gwt客户端的问题
我知道GWT客户端和服务器之间的bean共享,通常放入包domain.shared。



然而,如何在GWT客户端上使用外部jar库中的现有bean?



因为我总是收到这条消息。
没有源代码可用于类型xxxx.xxxx.bean您是否忘记继承所需的模块?

解决方案

假定您的bean位于 xxx.xxx.bean 包中,并且它们位于导入的 my_beans.jar 库中。
$ b

在应用程序中创建一个文件夹 src 树(或 src / main / java 如果您使用的是maven)名称 xxx / xxx



创建一个新的

 <$ c $   C><模块> 
<继承了name ='com.google.gwt.user.User'/>
< source path =bean/>
< / module>

编辑您的 Application.gwt.xml 和添加此行

 < inherits name =xxx.xxx.MyBeans/> 

请注意, xxx.xxx.bean package必须使用GWT支持的类。



您应该检查 my_beans.jar 库包含要使用的bean的Java源文件。


I have a question about share the java bean in library to gwt client I know bean share between GWT client and server usually put into package domain.shared.

However, how can I make use of existing bean from external jar library on GWT client?

Because I always got this message. No source code is available for type xxxx.xxxx.bean did you forget to inherit a required module?

解决方案

Given that your beans are in the package xxx.xxx.bean, and they are in an imported my_beans.jar library.

Create a folder in your Application src tree (or src/main/java if you are using maven) with the name xxx/xxx

Create a new Module file in this folder called MyBeans.gwt.xml with this content:

<module>
  <inherits name='com.google.gwt.user.User'/>
  <source path="bean"/>
</module>

Edit your Application.gwt.xml and add this line

<inherits name="xxx.xxx.MyBeans"/>

Be aware that all Classes in the xxx.xxx.bean package must use classes supported by GWT.

You should check as well that the my_beans.jar library includes the java source files of the beans you are going to use.

这篇关于如何从外部库共享bean到GWT客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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