spring mvc not returning json content - error 406

后端 未结 14 1276
温柔的废话
温柔的废话 2020-11-30 05:10

I am using Spring MVC with JSON as specified in Ajax Simplification Spring 3.0 article.

After so many attempts and variations of my code depending on advice found on

相关标签:
14条回答
  • 2020-11-30 05:41

    I had this problem too, you have to add <mvc:annotation-driven /> in your configuration xml

    and

    <!-- Jackson -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.databind-version}</version>
            </dependency>
    

    in your pom.xml

    0 讨论(0)
  • 2020-11-30 05:41

    Using jQuery , you can set contentType to desired one (application/json; charset=UTF-8' here) and set same header at server side.

    REMEMBER TO CLEAR CACHE WHILE TESTING.

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