java web 415,EXTJS4 前台数据,后台springMVC @RequestBody接出现异常415,不支持的媒体类型...

EXTJS4 前台数据,后台springMVC @RequestBody接出现错误415,不支持的媒体类型

EXTJS4 store var store = Ext.create('Ext.data.Store',{

model : 'Books',

//设置分页大小

pageSize : 5,

proxy : {

type : 'ajax',

api : {

read : _path+'/book/allBook.html',

create : _path+'/book/insertBook.html',

update : _path+'/book/updateBook.html',

destroy : _path+'/book/deleteBook.html'

},

actionMethods:{

create: "POST", read: "GET", update: "POST", destroy: "POST"

},

reader : {

type : 'json',

root : 'list',

totalProperty : 'total'

},

writer : {

//encode : true,

type: 'json',

allowSingle : 'true'

//root: 'data'

},

autoLoad : true

}

});

保存时用store.sync();,后台controller @RequestMapping(value="/updateBook.html")

@ResponseBody

public void updateBook(@RequestBody List books) {

if(books == null){

System.out.println("*******************");

}

System.out.println("update "+books.size());

//bookService.insertBook(book);

}

firbug 中响应头Cache-Controlmust-revalidate,no-cache,no-store

Content-Length1417

Content-Typetext/html;charset=ISO-8859-1

DateWed, 07 Jan 2015 01:57:07 GMT

ServerJetty(8.1.14.v20131031)

请求头Accepttext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Encodinggzip, deflate

Accept-Languagezh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3

Content-Length221

Content-Typeapplication/json; charset=UTF-8

CookieJSESSIONID=1pdj7ysreqg5c1wg0m42lp79sn

Hostlocalhost:8085

Refererhttp://localhost:8085/books/book/listBook.html

User-AgentMozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0

X-Requested-WithXMLHttpRequest

POST信息:{"bookid":1,"bookname":"\u5c0f\u738b\u5b50","author":"\u5730\u5728","price":"11.2","publishHouse":"\u4eba\u6c11\u51fa\u7248\u793e","publishTime":"","bookKeys":"\u52b1\u5fd7,\u7ae5\u8bdd","bookStatus":0,"bookIndex":"a001"}

------解决思路----------------------

然后呢,,出现了什么问题??

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值