collection下:
List list = new ArrayList();
list.add();
<%
List all = new ArrayList();
all.add("liuhui");
all.add("www.google.com");
all.add("afdnlw@gmail.com");
request.setAttribute("allinfo",all);
%>
<h1>${allinfo[0]}</h1>
<h1>${allinfo[1]}</h1>
<h1>${allinfo[2]}</h1>
Map下
Map map = new Map();
map.put(key,value)
<%
Map map = new HashMap();
map.put("liuhui","刘辉");
map.put("google网址","www.google.com");
map.put("刘辉邮箱","afdnlw@gmail.com");
request.setAttribute("info",map);
%>
<h1>KEY为刘辉的内容分是:${info["liuhui"]}</h1>
<h1>KEY为google网址的内容分是:${info["google网址"]}</h1>
<h1>KEY为刘辉邮箱的内容分是:${info["刘辉邮箱"]}</h1>
总结:输出Collection集合时候可以通过数组来输出,输出map时依然要用key和value