web services - consuming array of json object in jersey in java -
to consume single object in jersey have method
@post @consumes(mediatype.application_form_urlencoded) @produces(mediatype.application_json) public response postperson(multivaluedmap<string, string> personparams){ responsebuilder response = response.ok(); return response.build(); } working well.
my doubt how can consume list of objects in jersey
thing @post @consumes(mediatype.application_form_urlencoded) @produces(mediatype.application_json) public response postperson(list<person> person){ responsebuilder response = response.ok(); return response.build(); }
i did googling didn't found working example.
it seems want pass form data list:
@post @consumes(mediatype.application_form_urlencoded) @produces(mediatype.application_json) public response postperson(@formparam("person") list<string> person){ responsebuilder response = response.ok(); return response.build(); } <html><body> <form action="http://localhost:9998/myresource" method="post"> <input type="checkbox" name="person" value="a">a</input> <input type="checkbox" name="person" value="b">b</input> <input type="checkbox" name="person" value="c">c</input> <input type="submit">ok</input> </form> </body></html>
similarly person
object, have map diffrent property can post list
of person
source:jersey restful - how work multiselect checkboxes? has worked me.
Comments
Post a Comment