JSP页面读取不到 Map中的数据

狼王_ 狼王_ 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在JSP页面中无法读取到数据,挑战到 list.jsp 后一片空白。。代码如下
我在 EmployeeHandler 中定义的方法如下:
@RequestMapping("/emps")
public String list(Map<String,Object> map){
map.put("employees", employeeDao.getAll());
return "list";
}
在JSP页面中读取数据如下:
<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>
...全文
评论 9
收藏 已收藏
分享
返回顶部
狼王_
Web 开发 81,107 成员 341,720 内容