发送一个ArrayList如GWT-RPC的参数
题
我试图发送一个ArrayList在GWT RPC服务但继续失败。 这是我的代码片段
greetingService.addNewQuestion(questionnaireKey, questionText, qcList, new AsyncCallback<Boolean>(){
@Override
public void onFailure(Throwable caught) {
Window.alert("Something went wrong!\n"+caught.getMessage());
}
@Override
public void onSuccess(Boolean result) {
Window.alert("Question Added!");
}
});
QuestionChoice是没有方法的简单对象,qcList是QuestionChoice的ArrayList
public class QuestionChoice implements IsSerializable{
/**
*
*/
private static final long serialVersionUID = 5668640935838672293L;
public String text;
public boolean isCorrect;
public QuestionChoice(){
}
public QuestionChoice(String text, boolean isCorrect){
this.text = text;
this.isCorrect = isCorrect;
}
}
有任何人试图发送一个ArrayList如GWT-RPC的参数? 如果你这样做,请尽量在这里发表您的示例代码。 谢谢你。
解决方案
是,它可以发送一个ArrayList如GWT-RPC调用的参数。在开发GWT-RPC的代码,很多时候,你可能会遇到错误在GWT-RPC请求被调用时,这是由于在GWT-RPC服务的改变,可能还没有对应于编译GWT-RPC客户端定义。为了解决这个问题,你必须重新启动开发服务器,只要你在服务器端类改变你的代码,或在GWT-RPC服务确定指标(即GreetingService的,GreetingServiceAsync和GreetingServiceImpl)
其他提示
如果您正在使用GWT 1.5和Java 1.6,问题是@Override批注,你是不是真的覆盖的方法,要实现。摆脱注释,一切都应该去罚款。
不隶属于 StackOverflow