81,092
社区成员
发帖
与我相关
我的任务
分享
<c:if test="${ empty requestScope.employees }">
没有任何员工信息。
</c:if>
<c:if test="${ !empty employees }">
<table border="1" cellpadding="10" cellspacing="0">
<tr>
<th>ID</th>
<th>LastName</th>
<th>Email</th>
<th>Gender</th>
<th>Department</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<c:forEach items="${requestScope.employees}" var="emp">
<tr>
<th>${emp.id}</th>
<th>${emp.lastName}</th>
<th>${emp.email}</th>
<th>${emp.gender==0?'Female':'Male'}</th>
<th>${emp.department.departmentName}</th>
<th><a href="">Edit</a></th>
<th><a href="">Delete</a></th>
</tr>
</c:forEach>
</table>
</c:if>
@RequestMapping("/stu")
public String query(Model model) {
model.addAttribute("employees", employeeDao.getAll());
return "list";
}
[/code]
@RequestMapping("/emps")
public ModelAndView list(){
ModelAndView view=new ModelAndView("list");
view.addObject("employees", employeeDao.getAll());
return view;
}
遍历使用
<c:forEach items="${employees}" var="emp">就可以了。。。。