spring MVC接收请求体总是多一个等号

    xiaoxiao2021-03-25  178

    摘要: spring MVC接收请求体总是多一个等号 比如我发送的请求体是字符串aaa spring MVC 接收到的是aaa= 接口如下:

    spring MVC接收请求体总是多一个等号

    比如我发送的请求体是字符串aaa  spring MVC 接收到的是aaa=  接口如下:

    /*** * @param requestInfoBean * @return */ @RequestMapping(value = "/ajax", produces = SystemHWUtil.RESPONSE_CONTENTTYPE_JSON_UTF) @ResponseBody public String ajax(@RequestBody String requestInfoBean,HttpServletRequest request) { System.out.println(requestInfoBean); System.out.println(request.getHeader("Content-Type")); return null; }

    为什么呢?  因为请求的content type不对  应该是:application/json;charset=UTF-8  而我设置的content type是:  application/x-www-form-urlencoded;charset=UTF-8 

    转载请注明原文地址: https://ju.6miu.com/read-4942.html

    最新回复(0)