第一步:加入必要的jar包

SpringMVC_19_返回JSON

第二步:编写返回的方法

注意返回值直接是一个集合就可以了 ,还要添加@ResponseBody注解

@ResponseBody
@RequestMapping("/testJson")
public Collection<Employee> testJson(){

    return employeeDao.getAll();
}

第三步:在前端响应这个方法

<a href="testJson" id="testJson">Test Json</a>

SpringMVC_19_返回JSON

相关文章:

  • 2021-09-24
  • 2022-02-04
  • 2021-11-25
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-23
  • 2022-02-09
  • 2022-02-09
  • 2022-02-09
  • 2021-12-27
  • 2021-10-28
  • 2021-12-03
相关资源
相似解决方案