POST JSON fails with 415 Unsupported media type, Spring 3 mvc

后端 未结 14 1540
执念已碎
执念已碎 2020-11-22 09:46

I am trying to send a POST request to a servlet. Request is sent via jQuery in this way:

var productCategory = new Object();
productCategory.idProductCategor         


        
相关标签:
14条回答
  • 2020-11-22 10:41

    I had the same issue. adding

    <mvc:annotation-driven />
    <mvc:default-servlet-handler />
    

    to the spring-xml solved it

    0 讨论(0)
  • 2020-11-22 10:42

    I had a similar problem but found the issue was that I had neglected to provide a default constructor for the DTO that was annotated with @RequestBody.

    0 讨论(0)
提交回复
热议问题