Hello everyone, can you help me please?
I try from Client side format string response to json array and display in
jtextetable.
My class javascript object :
package project.client;
import com . google . gwt. core . client . JavaScriptObject ;
import com . google . gwt. core . client . JsArray ;
class Livre extends JavaScriptObject {
protected Livre () {}
public final native String getTitre () /*-{ return this.Titre; }-*/;
public final native String getAuteurs () /*-{ return this.Auteur; }-*/;
public final native static JsArray <Livre > asArrayOfLivre ( String
json ) /*-{ return eval ( json );; }-*/;
}
my response string formated
res ="[\n";
while (rs.next()) {
String id = rs.getString("id");
String titre = rs.getString("titre");
String auteur = rs.getString("auteur");
res += "\t{Id: \""+id+ "\",\n";
res += "\t{Auteur: \""+titre+ "\",\n";
res += "\t{Titre: \""+auteur+ "\",\n";
res += "\t},\n";
}
res += "]\n";
And in client side :
public void onSuccess(String result)
{
JsArray<Livre> resultat = Livre.asArrayOfLivre (
result);
for (int i = 0; i < resultat.length(); i++) {
String Auteur = resultat.get(i).getAuteurs();
String titre = resultat.get(i).getTitre() ;
taskContainer.setText(i+1,0,Auteur);
taskContainer.setText(i+1,1,titre);
}
}
});
I have no error but if I test one window.alert("test")after
JsArray<Livre> resultat = Livre.asArrayOfLivre ( result); it isn't executed
so function don't executed? do you have idea for my problem?
Thank you.
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.