Hello everyone , can you help me please?
and after i try to receive and use json data but dont work
if i use resultTxt.setText(result); i have my data but i want to writte table with line received. thanks for you helping sorry for my english
-- in my server wich connect with mysql databse i send to my client one json table like that
rs = stmt.executeQuery("SELECT * FROM test"); res ="["; while (rs.next()) { String titre = rs.getString("id"); String auteur = rs.getString("comment"); res += "\t{\"Titre\": \""+titre+ "\",\n"; res += "\t\"Auteur\": \""+auteur+ "\",\n"; res += "\t},\n"; } res += "]\n";
and after i try to receive and use json data but dont work
in my client side
final ProjectServiceAsync getService = GWT.create(ProjectService.class); getService.connection( new AsyncCallback<String>() { public void onFailure(Throwable caught) { System.out.println("error"); } public void onSuccess(String result) { JSONValue jsonValue = JSONParser.parseStrict(result); com.google.gwt.json.client.JSONObject customerObject = jsonValue.isObject(); com.google.gwt.json.client.JSONArray jsonArray = customerObject.get("titre").isArray(); StringBuilder builder = new StringBuilder("** Livre ** \n"); builder.append(jsonArray.get(0).isObject().get("Titre").isString().stringValue()).append(" "); Window.alert(builder.toString()); //resultTxt.setText(result); } }); }
if i use resultTxt.setText(result); i have my data but i want to writte table with line received. thanks for you helping sorry for my english
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment