Spring JSON请求获取406(不可接受)
这是我的javascript: function getWeather() { $.getJSON('getTemperature/' + $('.data option:selected').val(), null, function(data) { alert('Success'); }); } 这是我的控制器: @RequestMapping(value="/getTemperature/{id}", headers="Accept=*/*", method = RequestMethod.GET) @ResponseBody public Weather getTemparature(@PathVariable("id") Integer id){ Weather weather = weatherService.getCurrentWeather(id); return weather; } spring-servlet.xml <context:annotation-config /> <tx:annotation-driven /> 收到此错误: GET http://localhost:8080/web/getTemperature/2 406 (Not Acceptable) 标头: 响应标题 Server Apache-Coyote/1.1 Content-Type text/html;charset=utf-8 …