1.思路
简单的一个数据库查询所有,将数据放入list列表,通过spring提供的model 传入到前端页面。
2.代码
controller:
/* * 员工列表 * */ @RequestMapping("list") public String listEmployee(HttpServletRequest request, Model model){ List<Employee> employees = employeeService.list(); //request.setAttribute("employees",employees); model.addAttribute("employees",employees); return "emplist"; }
service:(实现代码) 简单的调用dao中的方法
@Autowired public EmployeeServiceImpl(EmployeeDao employeeDao) { this.employeeDao = employeeDao; }
3.效果
标签:request,employees,list,列表,employeeDao,jsp,ems,model From: https://www.cnblogs.com/sxwgzx23/p/18054948