jsp遍历所有数据标签与转义标签(2)
来源:未知 责任编辑:责任编辑 发表时间:2015-09-17 09:43 点击:次
for(int i=0;i<len;i++){
collection .add( Array.get(items, i));
}
}
Iterator it = collection.iterator();
while(it.hasNext()){
Object obj = it.next();
this.getJspContext().setAttribute(var,obj);
this.getJspBody().invoke(null);
}
}
}
Jsp文件
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="example" prefix="example"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>遍历各种类型数据</title>
</head>
<body>
<%
List list = new ArrayList();
list.add(1);
list.add("aa");
list.add("bb");
list.add(2);
request.setAttribute("list",list);
%>
<example:forEachAll var="str" items="${list}">
${ str }<br>
</example:forEachAll>
<hr>
<%
Map map = new HashMap();
map.put("1","aa");
map.put(2,"aa");
map.put(3,"aa");
map.put(4,"aa");
相关新闻>>
- 发表评论
-
- 最新评论 更多>>