https://www.cnblogs.com/wqsbk/p/6884723.html
几个需要的jar包
http://mvnrepository.com/search?q=jackson
ajax传json对象
ContentType: 'application/json; charset=utf-8', 表示data的类型是json
var myData = {styleNum : "styleNum", moldPart:"moldPart"}; //myData 存放数据
$.ajax({
url: getPath()+'/dropdown/selectanwithsm.action',
type: 'post',
data: myData, //ajax 传输
dataType: 'json',
ContentType: 'application/json; charset=utf-8',
})
springMVC接受
@RequestParam: 如果想参数封装到Map中需要这个注解
@ResponseBody: 作用在 return 一个json对象, 前台能用ajax接收
@RequestMapping(value="/selectanwithsm", method=RequestMethod.POST)
@ResponseBody
public List<Map<String, Object>> selectANWithSM(@RequestParam Map<String, Object> m){
System.out.println("\n\n\n\n\n"+m.get("styleNum"));
// return dds.selectANWithSM();
return null;
}