search

Home  >  Q&A  >  body text

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;

}

....
求大神解答

大家讲道理大家讲道理2891 days ago325

reply all(3)I'll reply

  • 伊谢尔伦

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

    It is not possible to directly specify the parameter as Map in the Controller. You need to encapsulate a Bean to receive the data. You can watch this video: http://www.imooc.com/learn/558

    reply
    0
  • 阿神

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

    Post json on the front end, and just use @RequestBody as the backend controller parameter

    reply
    0
  • 伊谢尔伦

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

    Post json from the front end, and just use @RequestBody as the backend controller parameter.
    I agree with the answer above. Use post request and @RequestBody will automatically parse it

    reply
    0
  • Cancelreply