读书人

lt;s:iterator标签应用

发布时间: 2012-09-06 10:37:01 作者: rapoo

<s:iterator标签使用
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
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%>">

<title>My JSP 'result.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>
<table align="center" width="40%" border="1">
<tr>
<td>id
</td>

<td>username
</td>

<td>password
</td>

<td>userId
</td>
</tr>
<s:iterator value="#request.list" id="us">
<tr>
<td><s:property value="#us.id"/>
</td>

<td><s:property value="#us.username"/>
</td>

<td><s:property value="#us.password"/>
</td>

<td><s:property value="#us.userId"/>
</td>
</tr>
</s:iterator>
</table>

username:${user.username}<%= request.getAttribute("username") %><br>
password:${user.password}<%= request.getAttribute("password") %><br>



</body>
</html>

读书人网 >软件架构设计

热点推荐