例子如下:
<%@page import="java.util.*,java.text.*" %>
<%@ page contentType="text/html; charset=GB2312" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%
HashMap animals = new HashMap();
animals.put(new Integer(1), "猫");
animals.put(new Integer(2), "狗");
animals.put(new Integer(3), "马");
animals.put(new Integer(4), "兔子");
animals.put(new Integer(5), "金鱼");
request.setAttribute("animals", animals);
%>
<html>
<head>
<title>
6
</title>
</head>
<body bgcolor="#ffffff">
<h1>
JBuilder Generated JSP
</h1>
<logic:iterate id="animals2" name="animals">
<bean:write name="animals2" property="value" />
</logic:iterate>
</body>
</html>
本文地址:http://com.8s8s.com/it/it11273.htm