Thank you, it runs now!
On Jul 12, 9:00 am, tedpottel <[email protected]> wrote:
> I am trying to send a http request to my webserver using GWT. I keep
> on getting a error on the line that reads
> Request request = builder.sendRequest(null, new RequestCallback()
>
> It says
> RequestCallback cannot be resolved to a type.
>
> I have the same problem on the line that catches the exception
> catch (RequestException e) {
> RequestException cannot be resolved to a object.
>
> I’m new at java, I’m assuming that those names are not declared? I was
> unable to get it to work and the current code I copied from google’s
> site. Is there something wrong with my installation?
>
> I’m using the eclipse plugin. The code looks like
>
> package gWTAJAX.client;
>
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.core.client.GWT;
> import com.google.gwt.event.dom.client.ClickEvent;
> import com.google.gwt.event.dom.client.ClickHandler;
> import com.google.gwt.event.dom.client.KeyCodes;
> import com.google.gwt.event.dom.client.KeyUpEvent;
> import com.google.gwt.event.dom.client.KeyUpHandler;
> import com.google.gwt.http.client.RequestBuilder;
> import com.google.gwt.user.client.rpc.AsyncCallback;
> import com.google.gwt.user.client.ui.Button;
> import com.google.gwt.user.client.ui.DialogBox;
> import com.google.gwt.user.client.ui.HTML;
> import com.google.gwt.user.client.ui.Label;
> import com.google.gwt.user.client.ui.RootPanel;
> import com.google.gwt.user.client.ui.TextBox;
> import com.google.gwt.user.client.ui.VerticalPanel;
>
> /**
> * Entry point classes define <code>onModuleLoad()</code>.
> */
> public class GWTAjax implements EntryPoint {
> /**
> * The message displayed to the user when the server cannot be
> reached or
> * returns an error.
> */
> public void onModuleLoad() {
> final Label label = new Label("helloted");
> RootPanel.get().add(label);
>
> // set uppc
> RequestBuilder builder = new
> RequestBuilder(RequestBuilder.GET,
> "www");
>
> try {
> Request request = builder.sendRequest(null, new
> RequestCallback()
> {
> public void onError(Request request, Throwable
> exception) {
> // Couldn't connect to server (could be
> timeout, SOP
> violation, etc.)
> }
>
> public void onResponseReceived(Request request,
> Response
> response) {
> if (200 == response.getStatusCode()) {
> // Process the response in
> response.getText()
> } else {
> // Handle the error. Can get the status text
> from
> response.getStatusText()
> }
> }
> });
> } catch (RequestException e) {
>
> }
> }
>
> }
>
> -Tedajax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---