How can I return or send a JSonObject to a client from the Server handle function?
The JsonObject the result of the some operations. But I didn't find a solution for returning this object
It is a problem that it must be JsonObject... (On the other hand I use Jetty for http protocol)
User Profile
Collapse
-
returning Json to client?
-
This code help u but my dear if you are new in java maybe you don't understand some sections, please ask me I try to explain you. Also you study hard and write more code examples about java...
Good work. -
...Code:import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; // main class public class Main { // for saving word objects private ArrayList<Word> words; public static void main(String[] args) throws IOException { Main main = new Main(); main.start();//start }Last edited by Frinavale; Dec 8 '09, 04:35 PM. Reason: Please post code in [code] ... [/code] tags. Added code tagsLeave a comment:
-
if you use split function you should also use parameters for parsing. In your example and, eat, cat words seperated with space and comma. You must give this arguments to split function. For example;
char [] delims = {"," , " "};
line.split(deli ms);Leave a comment:
-
you can also use like that;
Code:String line = rd.readLine(); char [] words = line.split(" "); system.out.println(words[0]); system.out.println(words[1]);Last edited by Frinavale; Dec 8 '09, 04:34 PM. Reason: Please post code in [code] ... [/code] tags. Added code tagsLeave a comment:
-
if(n > 100000 && n < 9999); --> here is a problem
if(n > 100000 && n < 9999) ";" should not use semicolon after ifLeave a comment:
No activity results to display
Show More
Leave a comment: