Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: None  |  size: 1.12 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. GWT RequestBuilder problem
  2. String url = "http://localhost:8080/my-spring-example/hello.htm";
  3. RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
  4. RequestCallback callback = new RequestCallback() {
  5.  public void onError(Request request, Throwable exception) {
  6.   spring.setHTML("Die Daten konnten nicht geladen werden");
  7.  }
  8.  
  9.  public void onResponseReceived(Request request, Response response) {
  10.   String responseAsText = response.getText();
  11.   if (responseAsText.equals("") || responseAsText == null ){
  12.    spring.setHTML("Der String ist leer");  
  13.   } else {
  14.    spring.setHTML(responseAsText);
  15.   }
  16.  }
  17. };
  18.  
  19. try {
  20.  rb.sendRequest(null, callback);
  21. } catch (RequestException e) {
  22.  e.printStackTrace();
  23. }
  24.        
  25. <head><title>Hello :: Spring 3 Application</title></head>
  26. <body>
  27.  <h1>Hello World, Spring 3.0!</h1>
  28.  <p>Es gibt 32 Einträge</p>
  29. </body>
  30.        
  31. <head><title>Hello :: Spring 3 Application</title></head>n
  32. <body>n
  33. t<h1>Hello World, Spring 3.0!</h1>n
  34. t<p>Es gibt 32 Eintr344ge</p>n
  35. </body>
  36.        
  37. <head><title>Hello :: Spring 3 Application</title></head>n
  38. <body>n
  39. t<h1>Hello World, Spring 3.0!</h1>n
  40. t<p>Es gibt 32 Eintr344ge</p>n
  41. </body>