How can share bean from external library to GWT client?

北慕城南 提交于 2019-12-04 12:07:57

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.

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.

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