SpringMVC_19_返回JSON
第一步:加入必要的jar包
第二步:编写返回的方法
注意返回值直接是一个集合就可以了 ,还要添加@ResponseBody注解
@ResponseBody
@RequestMapping("/testJson")
public Collection<Employee> testJson(){
return employeeDao.getAll();
}
第三步:在前端响应这个方法
<a href="testJson" id="testJson">Test Json</a>