Ajax controller type when requesting assignment will be the same, but the return value, because it will take the view resolver, it will be resolved in the form of address, but does not return data, the need to add annotation on the method, the return type resolution type into json
A return to the basic type
@ResponseBody return type parsed form into json
Second, the return object
You need to import the jar package
Annotate @ResponseBody on the method need to return an object
Third, the return type is consistent with the object list
Note: ajax garbled
Cause when parsing String, default is ISO-8859-1
Two solutions
First, annotation
Adding annotations @RequestMapping attribute produces = "text / html; charset = UTF-8"
Second, be configured springmvc
Because the assignment is the constructor, so to configure file
index is the index of the constructor, starting from 0.