一、request 范围 print_map.jsp
<%@ page contentType="text/html" pageEncoding="UTF-8" import="java.util.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EL输出集合</title>
</head>
<body>
<%
Map map = new HashMap(); // 实例化 List 接口
map.put("yc", "雨尘"); // 向集合中增加内容
map.put("etecha", "www.etecha.com"); // 向集合中增加内容
map.put("email", "914803581@qq.com"); // 向集合中增加内容
request.setAttribute("info", map); // 向 request 集合中保存
%>
<h3>key 为 的内容:${info["yc"]}</h3>
<h3>key 为 的内容:${info.etecha}</h3>
<h3>key 为 的内容:${info.email}</h3>
</body>
</html>
二、session 范围 print_map_session.jsp
<%@ page contentType="text/html" pageEncoding="UTF-8" import="java.util.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EL输出集合</title>
</head>
<body>
<%
Map map = new HashMap(); // 实例化 List 接口
map.put("yc", "雨尘"); // 向集合中增加内容
map.put("etecha", "www.etecha.com"); // 向集合中增加内容
map.put("email", "914803581@qq.com"); // 向集合中增加内容
session.setAttribute("info", map); // 向 request 集合中保存
%>
<h3>key 为 的内容:${info["yc"]}</h3>
<h3>key 为 的内容:${info["etecha"]}</h3>
<h3>key 为 的内容:${info.email}</h3>
</body>
</html>
三、application 范围 print_map_application.jsp
<%@ page contentType="text/html" pageEncoding="UTF-8" import="java.util.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EL输出集合</title>
</head>
<body>
<%
Map map = new HashMap(); // 实例化 List 接口
map.put("yc", "雨尘"); // 向集合中增加内容
map.put("etecha", "www.etecha.com"); // 向集合中增加内容
map.put("email", "914803581@qq.com"); // 向集合中增加内容
application.setAttribute("info", map); // 向 request 集合中保存
%>
<h3>key 为 的内容:${info.yc}</h3>
<h3>key 为 的内容:${info["etecha"]}</h3>
<h3>key 为 的内容:${info["email"]}</h3>
</body>
</html>