You ought to use generics to define your AsyncCallback. This probably
isn't causing your problem, but it should look something like this:
serviceClientRemoteAsync.getNom(text, new AsyncCallback<String>() {
public void onFailure(Throwable throwable) {
// display error
}
public void onSuccess(String result) {
// use string
}
});
Your ServiceClientRemote should also declare that it returns a String.
Also, you haven't said what "doesn't work" means. Do you know if the
code in yellow getting run?
HTH,
Paul
Adil BENHAMID wrote:
> the code in yellow does not work
>
>
> public *class* Root *implements* EntryPoint {
>
> TextBox textBox = *new* TextBox();
>
> HorizontalPanel monPanel = *new* HorizontalPanel();
>
> /**
>
> * This is the entry point method.
>
> */
>
> *public* *void* onModuleLoad() {
>
> *//Ce label, il s'affiche aprés execution*
>
> Label label1 = *new* Label();
>
> label1.setText("login1");
>
> monPanel.add(label1);
>
> monPanel.add(textBox);
>
> Button saveButton = *new* Button("Save");
>
> saveButton.addClickListener(*new* ClickListener() {
>
> *public* *void* onClick(Widget sender) {
>
> // _créaion_ _du_ _proxy_
>
> GWTServiceClientRemoteAsync serviceClientRemoteAsync = *null*;
>
> *if* (serviceClientRemoteAsync == *null*) {
>
> serviceClientRemoteAsync = (GWTServiceClientRemoteAsync) GWT
>
> ./create/(GWTServiceClientRemote.*class*);
>
> ServiceDefTarget endpoint = (ServiceDefTarget) serviceClientRemoteAsync;
>
> endpoint.setServiceEntryPoint(GWT./getModuleBaseURL/()
>
> + "/GWTServiceClientRemote");
>
> }
>
> serviceClientRemoteAsync.getNom(textBox.getText(),
>
> *new* _AsyncCallback_() {
>
> *public* *void* onFailure(Throwable throwable) {
>
> Window./alert/("erreur");
>
> }
>
> *public* *void* onSuccess(Object object) {
>
> *//Ce label ne s'affiche pas aprés execution*
>
> *Label label = new* Label();
>
> *label.setText("login");*
>
> *monPanel.add(label);*
>
> String retour = (String) object;
>
> Window./alert/(retour);
>
> }
>
> });
>
> }
>
> });
>
> monPanel.add(saveButton);
>
> RootPanel./get/().add(monPanel);
>
> }
>
> }
>
>
>
> 2009/6/6 Dean S. Jones <[email protected]
> <mailto:[email protected]>>
>
>
> some example code would be helpful.
>
>
>
>
> --
> ¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°
> Adil BENHAMID
> º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---