SpringMVC_19_返回JSON

第一步:加入必要的jar包 第二步:編寫返回的方法 注意返回值直接是一個集合就可以了 ,還要添加@ResponseBody註解 @ResponseBody @RequestMapping("/testJson") public Collection<Employee> testJson(){ return employeeDao.getAll(); } 第三步:在前端響應這個方法 <a
相關文章
相關標籤/搜索