JSP页面读取不到 Map中的数据
在JSP页面中无法读取到数据,挑战到 list.jsp 后一片空白。。代码如下
我在 EmployeeHandler 中定义的方法如下:
@RequestMapping("/emps")
public String list(Map<String,Object> map){
map.put("employees", employeeDao.getAll());
return "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>
...全文
相关推荐
jsp页面iterator遍历数组、Map、List
该文档代码讲述了如何在jsp页面iterator遍历数组、Map、List集合
servlet读取数据库代码到jsp页面表格示例
本示例为servlet+jsp+mysql做的。基于servlet从mysql数据库读取数据到jsp页面,并提供增删改查功能,解压后导入eclipse即可使用。
springMVC如何将controller中数据传递到jsp页面
主要介绍了springMVC如何将controller中数据传递到jsp页面,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
jstl读取map.txt
jstl读取map.txt
jsp网页产生json传值到java的servlet,再回传到jsp页面
jsp网页通过ajax传递json数据到java的servlet中,servlet处理数据后回传json数据到jsp页面


Web 开发
