Use c:forEach to traverse List, in jsp but cannot output

ask God to answer ha, I have tried many times, but it still doesn"t work. It can"t be displayed on the jsp page. I don"t know why.
backend code:
servlet code:

    EmployeeDao employeeDao = new EmployeeDaoImpl();
    List<Employee> employeeList = employeeDao.findAllEmployee();
    request.setAttribute("empList", employeeList);
    request.getRequestDispatcher("/test.jsp").forward(request, response);

Front end code:

:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

foreach:
<table>
            <tr>
                <th>ID</th>
                <th></th>
            </tr>
            <tr>
            <c:forEach items="${empList}" var="aa">
                    <th>${aa.employeeId}</th>
                    <th>${aa.employeeName}</th>
            </c:forEach>    
            </tr>
  </table>
  

I debugged servlet:

with eclipse

it is obvious that there is value here, but it just can"t be passed on.
ask for answers

Mar.10,2021

your tr should also be put in forEach. It is estimated that there is a problem with the label display. Is there any error message? Why don't you take a look at the html source code shown at the front end to see what the output looks like?


first of all, you make sure that the next page receives the value. Page F12 to see if there is your value in the response to this request, if there is a value, the page syntax is incorrect, no value, background delivery error. First locate the problem, and then check out


Thank you! I found the reason, the code is no problem, but I opened it in the wrong way, because it is servlet, which button should be used to jump to the current page, so it has a value. Hee hee. Thank you all


what is the reason for displaying a blank page

Menu