below is the code where i execute the rpc request. i create getdata()
and getdata1() to get execute different query. i am using two Async
object to make call. i am not sure is it correct as i got error when
i use one. any help/advice is welcome and appreciated. :D
private void getData() {
AsyncCallback<Object> callback = new AsyncCallback<Object>() {
// fail
public void onFailure(Throwable ex) {
RootPanel.get().add(new HTML(ex.toString()));
}
// success
public void onSuccess(Object result) {
// Cast the result into the object that was sent
// This casts the random object into DataContainer
// Since the object is an array we use []
DataContainer[] displayData = (DataContainer[]) result;
}
};
callProvider.getData(callback);
}
private void getData1() {
final int value1 = value;
AsyncCallback<Object> callback1 = new AsyncCallback<Object>(){
// fail
public void onFailure(Throwable ex) {
RootPanel.get().add(new HTML(ex.toString()));
}
// success
public void onSuccess(Object result) {
// Cast the result into the object that was sent
// This casts the random object into DataContainer
// Since the object is an array we use []
displayData1 = (DataContainer[]) result;
}
};
// remote procedure call to the server to get the data
callProvider1.getData1(callback1);
}
On Feb 6, 11:46 am, mon3y <[email protected]> wrote:
> Hi
>
> A code snippet would be nice, so we can see where you're going wrong.
>
> Also put a Window.alert(""), in your onFailure and onSuccess of your
> second call to see what you get.
>
> If it comes into the onFailure of your second call, there must be
> something wrong with the way you're calling the server side or your
> interfaces.
>
> If it comes in on your onSuccess, it must be a logic error, or
> something else pertaining to your client side code.
>
> If you make the first call successful and you call the second one the
> same way(logically) then there should be no issues.
>
> :)
>
> On Feb 6, 12:39 pm, ytbryan <[email protected]> wrote:
>
> > Hi all,
> > i know gwt don support synchronous call and i read it somwhere that
> > there is actually don need to make rpc call synchronous.
>
> > but i created an application with buttons like " save data" and "
> > display result "that will communicate to server by fetching data or
> > saving data.
>
> > when the application starts, it will automatically display the first
> > result with its first rpc call. but when i click the display second
> > result's button....... it doesn't work anymore. any subsequent rpc
> > call after the first one don't work.
>
> > what is wrong here? and what am i missing? can someone advice me? the
> > usual rpc example online only show how to make one rpc call. is there
> > a way to make multiple calls that do different task? thank you for
> > your time in viewing this post.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---