Problem with Spring 3 + JSON : HTTP status 406?

前端 未结 5 2305
一整个雨季
一整个雨季 2021-02-09 01:20

I\'m trying to get a list of Cities by sending the State name through Ajax in my SpringMVC 3.0 project. For the purpose, I\'ve used the following call (using jQuery) in my JSP:

5条回答
  •  清歌不尽
    2021-02-09 01:46

    As Peter had written in his comment, the cause of the problem is inability of Spring to load Jackson. It is not loaded by dependencies by default. After I've added the dependency

      
        org.codehaus.jackson
        jackson-jaxrs
        1.9.2
      
    

    the JSON was returned after typing the address in the browser, without any tricks with Accept headers (as it is supposed to do).

    Tested on Tomcat 7.0.

提交回复
热议问题