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"}
------解决思路----------------------
然后呢,,出现了什么问题??