Spring MVC 415 Unsupported Media Type

前端 未结 7 1312
再見小時候
再見小時候 2020-11-28 13:01

I am using Spring 3.2 and try to use an ajax post request to submit an array of json objects. If this is relevant, I escaped all special characters.

I am getting an

7条回答
  •  北海茫月
    2020-11-28 13:34

    You may try with HttpServletRequest. it does not have any problem

      @RequestMapping(value = "/save-profile", method = RequestMethod.POST,consumes="application/json",headers = "content-type=application/x-www-form-urlencoded")
        public @ResponseBody String saveProfileJson(HttpServletRequest request){
           System.out.println(request.getParameter("profileCheckedValues"));
            return "success";
        }
    

提交回复
热议问题