我試圖在我們的gwt應用程序中聲明一個jsp。我正在使用請求生成器。在這裏我的代碼:GWT RequestBuilder問題
String url = "http://localhost:8080/my-spring-example/hello.htm";
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
RequestCallback callback = new RequestCallback() {
public void onError(Request request, Throwable exception) {
spring.setHTML("Die Daten konnten nicht geladen werden");
}
public void onResponseReceived(Request request, Response response) {
String responseAsText = response.getText();
if (responseAsText.equals("") || responseAsText == null){
spring.setHTML("Der String ist leer");
} else {
spring.setHTML(responseAsText);
}
}
};
try {
rb.sendRequest(null, callback);
} catch (RequestException e) {
e.printStackTrace();
}
如果我叫http://localhost:8080/my-spring-example/hello.htm,在螢火蟲的反應是:
<head><title>Hello :: Spring 3 Application</title></head>
<body>
<h1>Hello World, Spring 3.0!</h1>
<p>Es gibt 32 Einträge</p>
</body>
如果我打這個電話在我們的GWT應用程序,在螢火蟲的反應是空字符串。
如果是Ⅱ呼叫http://localhost:8080/my-spring-example/hello.htm,在Wireshark的反應是:
<head><title>Hello :: Spring 3 Application</title></head>\n
<body>\n
\t<h1>Hello World, Spring 3.0!</h1>\n
\t<p>Es gibt 32 Eintr\344ge</p>\n
</body>
,如果我做了我們的GWT應用程序的調用,在Wireshark的反應是一樣的:
<head><title>Hello :: Spring 3 Application</title></head>\n
<body>\n
\t<h1>Hello World, Spring 3.0!</h1>\n
\t<p>Es gibt 32 Eintr\344ge</p>\n
</body>
我可以」不明白,有什麼問題....調用是正確的,響應來了,但發生了一些事情,所以gwt客戶端只顯示空字符串作爲響應。我很困惑....