搜尋

首頁  >  問答  >  主體

java - springmvc 数据绑定时,如何自动接受复合对象?

springmvc 数据绑定时,如何自动接受复合对象(已封装Bean)

如:
Bean{

map<Long,List<T>> map;

}
Bean{

map<Object,List<T>> map;

}

Bean{

map<Long,map<Integer,Integer>> map;

}

Bean{

map<Long,map<Integer,List<T>>> map;

}

....
求大神解答

大家讲道理大家讲道理2894 天前340

全部回覆(3)我來回復

  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:57:09

    在Controller裡直接指定參數為Map是不行的,需要封裝一個Bean來接收資料。可以看下這段影片:http://www.imooc.com/learn/558

    回覆
    0
  • 阿神

    阿神2017-04-17 17:57:09

    前端post json過來,後端controller參數@RequestBody就可以了

    回覆
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:57:09

    前端post json過來,後端controller參數@RequestBody就可以了。
    同意樓上的回答,是用post請求,@RequestBody會自動解析的

    回覆
    0
  • 取消回覆