Spring的@requestBody报错415 (Unsupported Media Type)

问题描述

求助各位大神,Spring添加了@RequestBody参数后,无法跳转控制器,去掉参数可以正常跳转,这是为什么呢前台ajax跳转如下:varsaveDataAry=[];vardata1={"userName":"test","address":"gz"};vardata2={"userName":"ququ","address":"gr"};saveDataAry.push(data1);saveDataAry.push(data2);vardataJSON.stringify(saveDataAry)$.ajax({url:"test/testTemp2.do",type:'POST',dataType:"json",processData:false,contentType:"application/json",data:data,success:function(data){$("#p1").text(data.data.name);}});后台代码如下:@RequestMapping(value="/testTemp2",method=RequestMethod.POST)publicActionResulttestTemp(@RequestBodyList<TempModel>person){Spring的MappingJacksonHttpMessageConverter已经配置了不知道为什么前台一直报415

解决方案

解决方案二:

解决方案三:

解决方案四:
引用1楼rui888的回复:这个看过了呢,好像没有一个正确的答案啊?
解决方案五:

解决方案六:
大哥能私聊你吗
解决方案七:
引用4楼rui888的回复:大哥能私聊你吗
解决方案八:
封网,只能技术网站啊。stackoverflow上你找找看
解决方案九:
从request取呢?@RequestMapping(value="/save-profile",method=RequestMethod.POST,consumes="application/json",headers="content-type=application/x-www-form-urlencoded")public@ResponseBodyStringsaveProfileJson(HttpServletRequestrequest){System.out.println(request.getParameter("profileCheckedValues"));return"success";}
解决方案十:
http://blog.csdn.net/pczhouji/article/details/11878289
解决方案十一:
引用9楼u012463264的回复:

http://blog.csdn.net/pczhouji/article/details/11878289

大哥不行啊,能留下Q吗》
解决方案十二:
在你另外一个贴子里回复了。

时间: 2024-09-19 14:32:53

Spring的@requestBody报错415 (Unsupported Media Type)的相关文章

maven 整合springmvc spring myatis整合报错

问题描述 maven 整合springmvc spring myatis整合报错 java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.

spring+junit4测试报错,求大神解答

问题描述 spring+junit4测试报错,求大神解答 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308) at org.springframework.test.context.support.DependencyInjectio

spring 注入 多线程-spring多线程注入报错,求大神帮忙解决一下。。谢谢!!

问题描述 spring多线程注入报错,求大神帮忙解决一下..谢谢!! Error creating bean with name 'transactionManager': Singleton bean creation not allowed while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implement

gradle 编译spring源码报错

问题描述 gradle 编译spring源码报错 解决方案 Gradle对Spring源码编译gradle安装及编译spring源码Git下载Spring源码 Gradle编译Spring源码为Eclipse工程文件

spring+springmvc+mybatis 报错。求大神指教。

问题描述 spring+springmvc+mybatis 报错.求大神指教. 严重: StandardWrapper.Throwableorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'index': Injection of autowired dependencies failed; nested exception is org.springframework.b

exception-struts+spring+mybatis运行报错

问题描述 struts+spring+mybatis运行报错 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name

spring myeclipse-spring myeclipse 报错servlet

问题描述 spring myeclipse 报错servlet <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="ht

Linux 报错&quot;mount: unknown filesystem type

链接: http://blog.itpub.net/28602568/viewspace-1797429/ 标题: Linux 报错"mount: unknown filesystem type 'LVM2_member' "解决思路  作者:lōττéry版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.] 前言: 同事叫把/dev/sda7 磁盘挂载到/data目录,当执行mount时报"mount: unknown filesystem type '

spring mvc-maven+springmvc 报错,找了一下午没解决。哪位大神帮忙看看。

问题描述 maven+springmvc 报错,找了一下午没解决.哪位大神帮忙看看. SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener at org.ap