java - how to read json response in jsp -


my client side program this:

defaulthttpclient httpclient = new defaulthttpclient(); httpresponse res = httpclient.execute(req);  

server side, have composed json response.

jsonobject jobject = new jsonobject(); jobject.put("responsecode", "100"); jobject.put("status", "success"); response.setcontenttype("application/json");     printwriter out = response.getwriter(); out.print(jobject); out.flush(); 

how can read responsecode , status in client side back.

httpresponse res = client.execute(req); bufferedreader rd = new bufferedreader(new inputstreamreader(response.getentity().getcontent()));  string line = ""; line = rd.readline();  /// json data 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -