`

SprignMVC 415 Unsupported Media Type 错误

 
阅读更多
解决问题参考两个地址:
http://blog.csdn.net/bettyly/article/details/7095740
http://liyanjie918.blog.163.com/blog/static/2022729020156894259240/

前台:
$.ajax({
			   type: "POST",
			   contentType:"application/json", //加入这个
			   url: "rest/approval/checkData",
			   data: JSON.stringify(ds), //要变成字符串
			   success: function(result){
			     alert( "Data Saved: " + result.msg );
			   }
			});



上面不解决问题情况下继续下面:
加入包:
<dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.6.3</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>2.6.3</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-asl</artifactId>
                <version>1.9.13</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-asl</artifactId>
                <version>1.9.13</version>
            </dependency>


controller:
@RequestMapping(value = "/searchGrid.do", method= RequestMethod.POST, headers="Accept=application/json")
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics