form  enctype属性指定为application/json,最后还是会强制的设置为“Content-Type:application/x-www-form-urlencoded”(具体原因待进一步确认)

如果后端用jackson转,那么就会报错:

org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

 

解决方法一:

后端接收 String  类型的参数,再用 json 工具转。

解决方法二:

前端用ajax post数据定指定 content-type。

 

更多推荐

html form 无法指定 content-type 为 application/json