<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="java.util.*" %>
<%@ page import="com.user.pojo.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<%String contextPath = request.getContextPath(); %>
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%
HashMap map = new HashMap();
User user = new User();
user.setUserName("张三");
user.setPassword("123123");
map.put("user",user);
//HashMap map1 = new HashMap();
User user1 = new User();
user1.setUserName("李四");
user1.setPassword("888888");
map.put("user1",user1);
HashMap map1 = new HashMap();
User user2 = new User();
user2.setUserName("王五");
user2.setPassword("111111");
map.put("user2",user2);
User user3 = new User();
user3.setUserName("赵六");
user3.setPassword("000000");
map.put("user3",user3);
List list = new ArrayList();
list.add(map);
list.add(map1);
//request.setAttribute("map",map);
request.setAttribute("list",list);
%>
----------------------------
<table>
<s:iterator value="#request.list" id="l">
<s:set value="#l" name="map"></s:set>
<s:iterator value="#map.keySet()" id="id">
<tr><td>
<s:property value="#id"/></td>
<s:iterator value="#map.get(#id)">
<td><s:property value="userName"/></td>
<td><s:property value="password"/></td>
</s:iterator>
</tr>
</s:iterator>
</s:iterator>
</table>
</body>
</html>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="java.util.*" %>
<%@ page import="com.user.pojo.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<%String contextPath = request.getContextPath(); %>
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%
HashMap map = new HashMap();
User user = new User();
user.setUserName("张三");
user.setPassword("123123");
map.put("user",user);
//HashMap map1 = new HashMap();
User user1 = new User();
user1.setUserName("李四");
user1.setPassword("888888");
map.put("user1",user1);
HashMap map1 = new HashMap();
User user2 = new User();
user2.setUserName("王五");
user2.setPassword("111111");
map.put("user2",user2);
User user3 = new User();
user3.setUserName("赵六");
user3.setPassword("000000");
map.put("user3",user3);
List list = new ArrayList();
list.add(map);
list.add(map1);
//request.setAttribute("map",map);
request.setAttribute("list",list);
%>
----------------------------
<table>
<s:iterator value="#request.list" id="l">
<s:set value="#l" name="map"></s:set>
<s:iterator value="#map.keySet()" id="id">
<tr><td>
<s:property value="#id"/></td>
<s:iterator value="#map.get(#id)">
<td><s:property value="userName"/></td>
<td><s:property value="password"/></td>
</s:iterator>
</tr>
</s:iterator>
</s:iterator>
</table>
</body>
</html>