JSTLtest.jsp 776 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <%@ page import="java.util.List" %>
  2. <%@ page import="com.xbw.java.Person" %><%--
  3. Created by IntelliJ IDEA.
  4. User: x'b'w
  5. Date: 2021/5/22
  6. Time: 11:27
  7. To change this template use File | Settings | File Templates.
  8. --%>
  9. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  10. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  11. <html>
  12. <head>
  13. <title>Title</title>
  14. </head>
  15. <body>
  16. <tr>
  17. <th>编号</th>
  18. <th>姓名</th>
  19. </tr>
  20. <%
  21. List<Person> list =(List<Person>) request.getAttribute("list");
  22. for (Person person : list){
  23. request.setAttribute("person",person);
  24. %>
  25. <tr>
  26. <td>${person.no}</td>
  27. <td>${person.name}</td>
  28. </tr>
  29. <%
  30. }
  31. %>
  32. </body>
  33. </html>