I hope someone can assist me with this. I'm trying to pass an customer id and customer name from a database result using rpc in gwt to the client. I found a way to pass one variable but I can't find a way to pass them both where the id is attached to the name. Can someone post a code example on how to do this. If you need more info let me know.
+2
A:
That is a simple java limitation. Just wrap the 2 fields in an object.
David Nouls
2010-02-24 13:23:16
I figured the problem out. I placed the data into json and converted it to a string and pass it to the client. I then parse the string and pulled the data out on the client side. This allowed me to pass as many variables as I need from the server to the client.
2010-02-26 14:20:03
+1
A:
As David Nouls said, you could just use an object, e.g.
import com.google.gwt.user.client.rpc.IsSerializable;
public class Customer implements IsSerializable {
private String id;
private String name;
public Customer(String id, String name) {
this.id = id;
this.name = name;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
larssg
2010-02-25 10:29:52