How can share bean from external library to GWT client?

女生的网名这么多〃 提交于 2019-12-06 07:37:50

问题


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?


回答1:


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.




回答2:


1) You can only include beans from the external jar library provided it is GWT compatible and declares a <ThirdPartyModuleName>.gwt.xml file which includes the package for the beans you need to use.

2) You should have the <ThirdPartyModuleName> included in your own <Module>.gwt.xml using <inherits> tag.



来源:https://stackoverflow.com/questions/13647270/how-can-share-bean-from-external-library-to-gwt-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!