/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.vaannila;
import java.util.ArrayList;
/**
*
* @author eswar@vaannila.com
*/
public class ActorData {
private String tvShow;
private String userName;
private String emailId;
public ActorData()
{
}
public ActorData(String tvShow, String userName, String emailId)
{
this.tvShow = tvShow;
this.userName = userName;
this.emailId = emailId;
}
public ArrayList loadData()
{
ArrayList userList = new ArrayList();
userList.add(new ActorData("The Office","Michael Scott","michael.scott@dundermifflin.com"));
userList.add(new ActorData("The Office","Dwight Schrute","dwight.schrute@dundermifflin.com"));
userList.add(new ActorData("The Office","Jim Halpert","jim.halpert@dundermifflin.com"));
userList.add(new ActorData("The Office","Pam Beesly","pam.beesly@dundermifflin.com"));
userList.add(new ActorData("The Office","Andy Bernad","andy.bernad@dundermifflin.com"));
userList.add(new ActorData("The Office","Angela Martin","angela.martin@dundermifflin.com"));
userList.add(new ActorData("Friends","Rachel Green","rachel.green@friends.com"));
userList.add(new ActorData("Friends","Monica Geller","monica.geller@friends.com"));
userList.add(new ActorData("Friends","Phoebe Buffay","phoebe.buffay@friends.com"));
userList.add(new ActorData("Friends","Joey Tribbiani","joey.tribbiani@friends.com"));
userList.add(new ActorData("Friends","Chandler Bing","chandler.bing@friends.com"));
userList.add(new ActorData("Friends","Ross Geller","ross.geller@friends.com"));
return userList;
}
/**
* @return the tvShow
*/
public String getTvShow() {
return tvShow;
}
/**
* @return the userName
*/
public String getUserName() {
return userName;
}
/**
* @return the emailId
*/
public String getEmailId() {
return emailId;
}
}
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>User Details</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<display:table id="data" name="sessionScope.UserForm.actorList" requestURI="/userAction.do" pagesize="10" >
<display:column property="tvShow" title="TV Show" sortable="true" />
<display:column property="userName" title="User Name" sortable="true" />
<display:column property="emailId" title="Email Id" sortable="true" />
</display:table>
</body>
</html>
原文:http://www.dzone.com/tutorials/java/struts/struts-example/struts-pagination-example-1.html
源代码:http://pan.baidu.com/share/link?shareid=4115038114&uk=3878681452