0

I am having an issue with the jqGrid. Here is the scenario.

  1. I have a jqgrid with form edit set to true
  2. On click of the submit button I need to pass additional parameters to the postData, one of which is an array itself.
  3. I am using the onClickSubmit event to add values to the postdata like so

    postdata.param1="1"; postdata.param2= [ { "a":1, "b":2 } ]

The issue is very similar to Post Nested Object to Spring MVC controller using JSON

and i have implemented the same from my pojo class and the front end side as well.

But I still get the error.

Any suggestions?

Sriram

Community
  • 1
  • 1
  • Have array which you use as parameter `param2` always one element? Are objects the elements of the array? Probably it would be enough to send `[1,2]` or `"1,2"` or `"a:1;b:2"` to the server? You can use `JSON.stringify( [ { "a":1, "b":2 } ])` instead of `[ { "a":1, "b":2 } ]`. All the options will **send** required data to the server and you can easy decode the data on the server side. There are sure many other possibilities. – Oleg Feb 12 '15 at 12:05
  • Thanks Oleg. there might be more elements in the array. I am stringifying the array and sending it. Now I am getting a 400(Bad request) from the server. At my wit's end here – Sriram Ramaswami Feb 13 '15 at 08:12
  • I'm not a Spring MVC developer. So I can't help you on the server side. In any way you can have parameter of **string** type on the server side where you can get JSON data. You can use the corresponding API of Spring MVC to convert the string to object. – Oleg Feb 13 '15 at 09:42
  • Thanks oleg. I will definitely take a look at the server side as well. – Sriram Ramaswami Feb 13 '15 at 11:52

0 Answers0