how post list of objects javascript spring mvc controller? can post arrays, objects, not combination of 2. code below.
javascript:
var utildata = gettabledata(); // sending data on server console.log(utildata); $.ajax({ url: "saveutildata2.html", type: "post", contenttype: "application/json", datatype: "json", data: {utilarray: utildata}, success: function(data){ alert("save sucessful"); }, error: function(){ alert("save wasn't successful"); } });
spring controller (tried changing utildata string[] , object[] ... both didnt work:
@requestmapping(value="/saveutildata2.html", method=requestmethod.post) public modelandview saveutildata2(@requestparam("utilarray") string[] utildata, httpservletrequest request) { system.out.println("util save data method 2"); modelandview mv = new modelandview("util"); return mv; }
Comments
Post a Comment