<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="display" uri="displaytag"%>
<%@ taglib prefix="linktone" uri="linktonetag"%>
<%@ page
import="com.lee.orderdish.util.ParamUtils,org.displaytag.sample.*,java.util.*,org.displaytag.tags.TableTag,com.linktone.taglib.displaytagpage.PageInfo"%>
<html>
<head>
<title>Simple jsp page</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/style.css" type="text/css" />
</head>
<body>
<%int currentPage = ParamUtils.getIntParameter(request,
"currentPage", 1);
TestList list = new TestList(100, false);
PageInfo pageInfo = new PageInfo();
pageInfo.setMaxCount(100);
pageInfo.setPageSize(6);
pageInfo.setCurrentPage(currentPage);
int startindex = pageInfo.getStart() - 1;
int endindex = pageInfo.getEnd() <= list.size() ? pageInfo.getEnd()
: list.size();
out.println("startIndex:" + startindex);
out.println("endIndex:" + endindex);
java.util.List subList = list.subList(startindex, endindex);
request.setAttribute("test", subList);
int type = 1;
int maxsize = 24;
%>
<center>
<linktone:displaywrap uid="aa" name="test" pagesize="6"
maxsize="<%=maxsize%>" append="age=34&type=1" requestURI="displaytagdemo.jsp" />
<display:table uid="currentElement" name="test" pagesize="6"
width="100%" class="Mars">
<display:column property="id" nowrap="true" title="ID" align="left" />
<display:column property="name" nowrap="true" title="名称" align="left" />
<display:column nowrap="true" title="编辑" align="left">
<a
href="javascript:alert('<%=((ListObject)currentElement).getId() %>')">编辑</a>
</display:column>
</display:table>
<display:table border="1" name="test" pagesize="6"
rowsize="2" width="100%" class="Mars">
<table width="100%">
<tr>
<td>{id}</td>
</tr>
<tr>
<td>{naMe}</td>
</tr>
<tr>
<td><a href="javascript:alert('{naMe}')">编辑</a></td>
</tr>
</table>
</display:table>
<linktone:displaywrap uid="aa" name="test" pagesize="6"
maxsize="<%=maxsize%>" append="age=34&type=1" requestURI="displaytagdemo.jsp" />
</center>
</body>
</html>
该文件源代码在:http://www.blogjava.net/Files/lyjjq/displaytagdemo.rar
用到的包和配置文件在:http://www.blogjava.net/Files/lyjjq/lib.rar