<%@ page contentType="text/html; charset=utf-8" import="java.util.*"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> forEach遍历

forEach遍历 c:forEach var="..." items="..."


<% String[] fruits = { "apple", "orange", "grape", "banana" }; %> String数组中的元素:
水果名称:${name}

世界人口排名2022前三

<% Map aMap = new HashMap(); aMap.put("中国", "1,447,301,400"); aMap.put("印度", "1,403,018,576"); aMap.put("美国", "334,282,669"); %> HashMap集合中的元素:
国家:${entry.key} 人口:${entry.value}