Brilliant Toby, thats exactly what I was missing, I kind of knew what
was going on, but couldnt work out WHERE I was going wrong. This is
the problem with coming from a functional (pure C) programming
background, Im really struggling with all this stuff happening at the
same time malarky!

I was thinking it was a GAE question because im trying to send data to
and from the datastore, again because im using both GWT and GAE, its
hard to figure out where one stops and the other starts!

Thanks anyway,  perfect response :D you are a star! Hopefully once Ive
fixed the way it works, it will just start working and i wont need
anymore help with this particular issue anyway!

On Aug 25, 11:30 pm, Toby Reyelts <[email protected]> wrote:
> This is more of a GWT question than a GAE question, but I agree that you're
> missing the point. An async callback is executed asynchronously (hence the
> name), and it looks like you're trying to treat it as if it happens
> synchronously:
>
>       ContactService.getoneContact(String Name,new AsyncCallback<String>()>
> {
>            public void onFailure(Throwable error) {
>                PhoneResult="ERROR";
>            }
>            public void onSuccess(String Phone) {
>                // This code is not executed until after the server returns a
> response.
>                // You need to put the code that handles the response here -
> such as posting an event, updating the UI, or otherwise dealing with the
> results.
>                PhoneResult=Phone;
>            }
>        });
>
>        // This code executes immediately after the RPC begins and almost
> guaranteed before it completes. Don't write code that depends upon the RPC
> having completed here.
>        return (Phone);
>
> On Tue, Aug 25, 2009 at 5:57 PM, John V Denley
> <[email protected]>wrote:
>
>
>
> > The following code returns "null" the first time it is run, and then
> > returns the previous request on the second time it is called.... can
> > anyone see whats going wrong? Surely it should wait until it gets the
> > server response before returning a value? or am I missing the point
> > here?
>
> >    private String GetOneContact(String Name) {
> >        //ContactService = GWT.create(ContactService.class);
> >        ContactService.getoneContact(Name,new AsyncCallback<String>()
> > {
>
> >            public void onFailure(Throwable error) {
> >                PhoneResult="ERROR";
> >            }
> >            public void onSuccess(String Phone) {
> >                PhoneResult=Phone;
> >            }
> >        });
> >        return (Phone);
> >    }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to