1,前台form表单提交,
后台
public String test(String id,String name){
testService.test(id,name);
}
2.前台提交String json 例如 var jsonshuzu2 = ‘{“id”:”1”,”name”:”1”}’;
后台
public String test(@RequestBody param, HttpServletRequest request){
String id = param.getString("id");
String name = param.getString("name");
或者 String id = (String)param.get("id");
String name = (String)param.get("name");
testService.test(id,name);
}
3,前台提交 var jsonshuzu = ‘[{“accountId” : 1, “memberId” : 1,”cityId” : 100,”cityName” : “青岛”,”sort” : 1},{“accountId” : 1,”memberId” : 1,”cityId” : 2332, “cityName” : “丽姿”,”sort” : 2}]’;
后台可以封到list model里
public String test(@RequestBody List<myModel> arrayList){
还有一种可以封到 model里
@RequestBody Mymodel myModel
}