GWT:GWT导出器:传递对象
我一直在努力将Java对象从Java通过JSNI(gwt exporter generated)传递到Java中,不知是否有人能提供帮助 我正在用Java创建一个对象(“Person”),将其传递给一个JSNI方法(“displayPerson”),该方法调用gwt exporter公开的Java方法(“CommonService.displayPerson”);但是,最后一个阶段的参数变为null 如果我传递一个字符串,它工作正常;我只是用我的东西解决了问题 Person在另一个GWT应用程序继承的GWT应用程序JAR中定义 谢谢你的关注 迈克 GWT应用程序 CommonService.java Person.javaGWT:GWT导出器:传递对象,gwt,jsni,gwt-exporter,Gwt,Jsni,Gwt Exporter,我一直在努力将Java对象从Java通过JSNI(gwt exporter generated)传递到Java中,不知是否有人能提供帮助 我正在用Java创建一个对象(“Person”),将其传递给一个JSNI方法(“displayPerson”),该方法调用gwt exporter公开的Java方法(“CommonService.displayPerson”);但是,最后一个阶段的参数变为null 如果我传递一个字符串,它工作正常;我只是用我的东西解决了问题 Person在另一个GWT应用程序
您不需要为Person类实现Exportable
public class Person {
如果其他人偶然发现这个问题,我现在在git://github.com/manstis/gwt-plugins.git 非常感谢,这很好——但只有当所有内容都在一个GWT模块中时。当将“Person”从一个GWT模块传递到另一个GWT模块时,“Person”的实例变量是未定义的:(我不知道。它应该可以工作。PluginService模块必须继承PluginCommon模块(Person的源是).PluginCommon模块必须有我读到你想把实例从一个GWT模块传递到另一个GWT模块。我正在为此构建一个小项目。现在它仅限于接口,但仍然有用。顺便说一下:我的stackoverflow配置文件包括我的电子邮件。
package com.anstis.pluginserver.client;
import org.timepedia.exporter.client.Export;
import org.timepedia.exporter.client.Exportable;
import com.anstis.plugincommon.shared.Person;
import com.anstis.plugincommon.shared.PluginCallback;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
@Export
public class CommonService implements Exportable {
public void displayPerson(Person person) {
//The below shows 'person' *IS* null
Window.alert("CommonService.displayPerson.person is "
+ (person != null ? "not " : "") + "null");
Window.alert("Name=" + person.getName());
}
}
package com.anstis.plugincommon.shared;
import org.timepedia.exporter.client.Exportable;
public class Person implements Exportable {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
public class Person {