Geronimo 叛逆者: 使用集成程序包:GlassFish JSTL 1.2 和 Apache Geronimo 2.0
2009-11-11 00:00:00 来源:WEB开发网
清单 4. Model 2 样式的 JSP 组件<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="org.developerworks.*" %>
<%@ page import="java.util.List" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>All Users</title>
</head>
<body>
<table>
<tr>
<td>UserID</td>
<td>UserName</td>
<td>Name</td>
</tr>
<%
List users = (List) request.getAttribute("users");
for (int i=0;i<users.size();i++){
User user = (User) users.get(i);
%>
<tr>
<td><%= user.getId() %></td>
<td><%= user.getUserName() %></td>
<td><%= user.getFirstName() %> <%= user.getLastName()
%></td>
</tr>
<%
}
%>
</c:forEach>
</table>
</body>
</html>
更多精彩
赞助商链接