<%@ page import="java.util.List" %> <%@ page import="java.util.ArrayList" %> <%@ page contentType="text/html; charset=UTF-8" language="java" %> <html> <head> <title>JSP - Hello World</title> </head> <body> <h1>Index</h1> <% List<String> names=new ArrayList<>(); names.add("小偷"); names.add("白领"); names.add("服务员"); List<Integer> money=new ArrayList<>(); money.add(33434); money.add(2434); money.add(324); %> <table border="1"> <tr> <th>职业</th> <th>工资</th> </tr> <% for (int i = 0; i < names.size(); i++) { %> <tr> <td> <%=names.get(i)%> </td> <td> <%=money.get(i)%> </td> </tr> <% } %> </table> </body> 这里是因为泛型后面的尖括号内没有内容
jsp写集合可能出现的错误500
最新推荐文章于 2024-09-08 11:09:43 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)