在jsp页面使用c:forEach无法显示数据,显示了源代码的解决方法

    科技2022-08-19  119

    在SSM项目中,在jsp页面引入了 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 然后在代码中使用

    <c:forEach items="${pageInfo.list}" var="emp"> <tr> <th>${emp.empId}</th> <th>${emp.empName}</th> <th>${emp.gender == "M" ? "男" : "女"}</th> <th>${emp.email}</th> <th>${emp.department.deptName}</th> <th> <button class="btn btn-info btn-sm"> <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> 编辑 </button> <button class="btn btn-danger btn-sm"> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除 </button> </th> </tr> </c:forEach>

    在前端页面死活都不出来数据,代码并没有错误 其实代码并没有错,是这个web-app版本2.0以上导致的错误 我们只需要在jsp页面加上一句isELIgnored="false"

    <%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>

    加上之后就可以正常显示数据了

    Processed: 0.008, SQL: 9