@RequestMapping(value="/book/getBook.do", produces = "text/html;charset=UTF-8")
public @ResponseBody String getBook(String name){
List<Book> list =bookService.getBook();
for(Book bo:list){
System.out.println("id:"+bo.getId()+" name:"+bo.getName()+" author:"+bo.getAuthor());
}
String json = JSONObject.toJSONString(list);
System.out.println("json:"+json);
return json;
}
produces = "text/html;charset=UTF-8" 即可