just for example of nested server call, assume I need the following three server call in sequence
1) call server to select the count of records satisfy the criteria
2) if call1 success, call server to select the content of records satisfy the criteria
3) if call1 and call2 success, call server to put the criteria in session
as RPC is Async., so I need to write something like the following?
AsyncCallback callback1 = new AsyncCallback(){
public void onSuccess(){
AsyncCallback callback2 = new AsyncCallback(){
public void onSuccess(){
AsyncCallback callback3 = new AsyncCallback(){
public void onSuccess(){
}
@Override
public void onFailure(Throwable caught){
}
}
}
@Override
public void onFailure(Throwable caught){
}
}
}
@Override
public void onFailure(Throwable caught){
}
}
As shown, it is very ugly and difficult to trace...
any better method?