What I want to do is passing a map to the method in Controller using @RequestParam, but it seems not working. While this is working in Struts 2 as value binding.
Below is what I am trying: In JSP using JQuery:
var order = {};
order['seq'] = "ASC";
var criteria = {};
criteria['label'] = "Directory";
$.post(context + 'menu/list',
{"orders" : order,
"criterias" : criteria}
The parameters I am trying to post is an 'map' object order and criteria for listing menu. In Java:
@RequestMapping("/{collection}/list")
public @ResponseBody Map<String, ? extends Object> list(@PathVariable String collection,
@RequestParam("criterias") Map<String, String> criteria,
@RequestParam("orders") Map<String, String> order) {
However, when I print out the map criteria & order in Java, it takes all value as below:
Criteria: {criterias[label]=Directory, orders[seq]=ASC}
Order: {criterias[label]=Directory, orders[seq]=ASC}
Can @RequestParam in Spring be used to init a Map parameter?