i'm having some troubles with my code. I assume it's not a Designer issue, but may be someone already dealt with it before. It's actually pretty simple: while loading, application requests some data from the server and shows it. Here is a basic example that demonstrates the problem:
Basic class:
- Code: Select all
package com.mycompany.project.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
public class ImageViewer implements EntryPoint {
private HTML html;
public void onModuleLoad()
{
RootPanel rootPanel = RootPanel.get();
html = new HTML("");
rootPanel.add(html, 0, 0);
getData();
}
public void getData()
{
ImageViewerService.Util.getInstance().getData(new AsyncCallback() {
public void onFailure(Throwable caught) {
Window.alert(caught.toString());
}
public void onSuccess(Object result) {
html.setHTML((String) result);
}
});
}
}
The servlet is just returning a string
- Code: Select all
return new String("just a simple test string");
Now it's actually working in both: hosted and web-mode, IE and FF3, BUT: try do load this in FF3 and hit refresh a few times. If you are making it slow - you will see the test string. Do it fast and you will get an alert with:
com.google.gwt.user.client.rpc.InvocationException
I'm using GWT 1.4. Any ideas what to do besides implementing sleep() before getData() ?