Ronak Joshi
Ronak Joshi

Reputation: 1583

Json parsing webservice in struts 2.0?

I have used JSONObject json = (JSONObject)new JSONParser().parse(jb.toString()); for getting json object in servlet and JSONObject result=new JSONObject();response.getWriter().write(result.toString()); for posting json object. But i have no idea how to do this in struts 2.0.

Upvotes: 0

Views: 143

Answers (2)

HASNEN LAXMIDHAR
HASNEN LAXMIDHAR

Reputation: 72

String "str" have Json message who extract json in action using key value pair example to more understanding...

JSONObject json = new JSONObject(str);
        rec_id = json.getInt("receptionist_id");
        tag_id = json.getInt("tag_id");

Upvotes: 1

PbxMan
PbxMan

Reputation: 7623

You need the Json Plug in. This plug in will be able to parse your action response into a JSON automatically and the interceptors will store your request into your action.

You have an example with Struts2 with annotations and datatables here

Upvotes: 2

Related Questions