Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
18
rated 0 times [  22] [ 4]  / answers: 1 / hits: 35561  / 9 Years ago, thu, october 8, 2015, 12:00:00

I have a json object in javascript,



filters = Object {assetType: CAR~LIGHT TRUCK, bodyType: SEDAN~SPORT UTIL}


I need to pass these values along with 5 more string value in query string.



url = '/starHome/exportToCsv/'+tier+'/?period='+period+'&level2='+level2+'&level3='+level3+'&level4='+level4+'&filters='+filters;


window.location.href = url;
when I tried to get filter parameter value in controller
request.getparamter(filters); I get [object object]



how can I pass this value to controller?.
I have a pojo class contains all these fields. Can I make use of that class?.


More From » json

 Answers
37

Thanks Everyone,
I have used JSON.stringify(filters);
and in controller



String filtersString = request.getParameter(filters);
Map<String,Object> result = new ObjectMapper().readValue(filtersString, HashMap.class);


Kindly reply back, if there s a better approach.


[#64802] Monday, October 5, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cadendericki

Total Points: 482
Total Questions: 109
Total Answers: 103

Location: Ecuador
Member since Thu, Jun 4, 2020
4 Years ago
cadendericki questions
Wed, Apr 7, 21, 00:00, 3 Years ago
Wed, Jul 8, 20, 00:00, 4 Years ago
Thu, May 14, 20, 00:00, 4 Years ago
;