GWT中的jquery load()等效项

GWT中的jquery load()等效项,gwt,Gwt,我想知道在不使用框架或任何GWT框架的情况下,GWT中是否有与jQuery等效的load() 我需要用GWT在div中加载一个文件.html 类似这样的内容:RootPanel.get(“content”).add(page.html) 有什么想法吗?添加以下内容: 到您的gwt.xml文件 然后,您可以使用HTML小部件和RequestBuilder执行一些操作 比如说 import com.google.gwt.http.client.*; ... HTML htmlWidget = nul

我想知道在不使用框架或任何GWT框架的情况下,GWT中是否有与jQuery等效的load()

我需要用GWT在div中加载一个文件.html

类似这样的内容:RootPanel.get(“content”).add(page.html)

有什么想法吗?

添加以下内容:
到您的gwt.xml文件

然后,您可以使用
HTML
小部件和RequestBuilder执行一些操作

比如说

import com.google.gwt.http.client.*;
...
HTML htmlWidget = null;
String url = "http://www.myserver.com/getData?type=3";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(url));

try {
  Request request = builder.sendRequest(null, new RequestCallback() {
    public void onError(Request request, Throwable exception) {

    }

    public void onResponseReceived(Request request, Response response) {
      if (200 == response.getStatusCode()) {
         htmlWidget = new HTML(response.getText());
      } else {
        // Handle the error.  Can get the status text from response.getStatusText()
      }
  }       
 });
} catch (RequestException e) {
  // Couldn't connect to server        
}
if(htmlWidget!=null){
    RootPanel.get("content").add(htmlWidget);
}

我看不出它是否编译(目前无法访问IDE),因此请原谅您可能需要更正的任何小错误。

这里介绍了几种方法


在您的场景中,我更喜欢带有html资源的客户端包。

我猜“添加此”中缺少了一些内容。一些链接?