web前端向java后端传递model的几种方法

1、通过fastjson传值

前端代码:

$.post("./test",{modelStr:JSON.stringify(data),collection:collection}, function (ret) {
                    //do something.
                });

后端代码:

@RequestMapping(value="test", method = RequestMethod.POST,produces={"application/json;charset=utf-8"})
    @ResponseBody
    public String test(String modelStr,String collection){
        Model model= JSONObject.parseObject(routePointStr, Model.class);
        return "test";
    }

 

你可能感兴趣的:(react,Javascript)