主页地址是:http://displaytag.sourceforge.net(不过,没有打开过,晕) 不过不影响我们用这个标签
下面是实际应用中的一个例子:
action部分和一般的分页机制的代码雷同, 取得list的时候,同样需要传入相应的参数pigeSize---一页显示的数据量,pigeNo---当前的页码。同样需要在daoIbatis里面进行算法,得到skip---显示数据前略过的数据, max 当前页显示的数据数量。
List wanList
=
getSqlMapClientTemplate().queryForList(
" WanInfo.getWanInfo " , waninfo, skip, max);
" WanInfo.getWanInfo " , waninfo, skip, max);
下面部分的代码,大概就是这个标签的自己特有的需要传入的东西 (待,接续)
Iterator iter
=
wanList.iterator();
for ( int i = skip; iter.hasNext(); i ++ ) ... {
cachedList.set(i, iter.next());
}
return cachedList;
for ( int i = skip; iter.hasNext(); i ++ ) ... {
cachedList.set(i, iter.next());
}
return cachedList;
jsp部分的代码如下: 其中后面的几个display:setproperty 属性的设置,是因为页面需要加上总共显示的页数,这个标签没有的机能,自己通过把 这个标签的配置文件里的内容删除,然后在jsp页面加上相应的display:setProperty,来使得页面显示出自己想要的效果来。
<
display:table
name
="${formList}"
cellspacing
="1"
cellpadding
="3"
requestURI ="" defaultsort ="0" export ="false" id ="list"
pagesize ="${pageSizeView}" styleClass ="list userList" align ="center" >
<% ... -- Table columns -- %>
< display:column property ="buType" sort ="false" headerClass ="sortable" titleKey ="ITIL411Form.buType" />
< display:column property ="companyCodes" sort ="false" headerClass ="sortable" titleKey ="ITIL411Form.companyCodes" />
< display:column property ="sequence" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.sequence" />
< display:column property ="companyName" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.companyName" />
<!-- 拠点名 -->
< c:if test ="${editFlg=='true'}" >
< display:column property ="baseName" url ="/ITIL411.html?method=changeWanInfo&actionName=ITIL410&methodName=search" paramId ="lwanConnectMngId" paramProperty ="lwanConnectMngId" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.baseName" />
</ c:if >
< c:if test ="${editFlg=='false'}" >
< display:column property ="baseName" url ="/ITIL411.html?method=viewWanInfo&actionName=ITIL410&methodName=search" paramId ="lwanConnectMngId" paramProperty ="lwanConnectMngId" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.baseName" />
</ c:if >
< display:column property ="lineDivision" sort ="false" headerClass ="sortable" titleKey ="ITIL413Form.lineDivision" />
< display:column property ="lineType" sort ="false" headerClass ="sortable" titleKey ="ITIL413Form.lineType" />
< display:column property ="lanIPaddress" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.lanIPaddress" />
< c:choose >
< c:when test ="${showKiKi == 'true'}" >
< display:column property ="assetTag" url ="/ITIL211.html?method=changeComputerInfo&actionName=ITIL410&methodName=search" paramId ="astId" paramProperty ="lassetId" sort ="false" headerClass ="sortable" titleKey ="ITIL210Form.assetTag" />
</ c:when >
< c:otherwise >
< display:column property ="assetTag" paramProperty ="lassetId" sort ="false" headerClass ="sortable" titleKey ="ITIL210Form.assetTag" />
</ c:otherwise >
</ c:choose >
< display:column property ="biginDayStr" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.biginDay" />
< display:column property ="aboveDayStr" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.aboveDay" />
< display:setProperty name ="paging.banner.placement" > both </ display:setProperty >
< display:setProperty name ="paging.banner.items_name" value ="" />
< display:setProperty name ="paging.banner.first" >< span class ="pagelinks" > [ < fmt:message key ='ITIL310F.first' /> / < fmt:message key ='ITIL310F.pre' /> ] {0} [ < a href ="{3}" >< fmt:message key ='ITIL310F.next' /></ a > / < a href ="{4}" >< fmt:message key ='ITIL310F.last' /></ a > ] < fmt:message key ='ITIL310F.total' /> < c:out value ="${pageCount}" /></ span ></ display:setProperty >
< display:setProperty name ="paging.banner.last" >< span class ="pagelinks" > [ < a href ="{1}" >< fmt:message key ='ITIL310F.first' /></ a > / < a href ="{2}" >< fmt:message key ='ITIL310F.pre' /></ a > ] {0} [ < fmt:message key ='ITIL310F.next' /> / < fmt:message key ='ITIL310F.last' /> ] < fmt:message key ='ITIL310F.total' /> < c:out value ="${pageCount}" /></ span ></ display:setProperty >
< display:setProperty name ="paging.banner.full" >< span class ="pagelinks" > [ < a href ="{1}" >< fmt:message key ='ITIL310F.first' /></ a > / < a href ="{2}" >< fmt:message key ='ITIL310F.pre' /></ a > ] {0} [ < a href ="{3}" >< fmt:message key ='ITIL310F.next' /></ a > / < a href ="{4}" >< fmt:message key ='ITIL310F.last' /></ a > ] < fmt:message key ='ITIL310F.total' /> < c:out value ="${pageCount}" /></ span ></ display:setProperty >
</ display:table >
requestURI ="" defaultsort ="0" export ="false" id ="list"
pagesize ="${pageSizeView}" styleClass ="list userList" align ="center" >
<% ... -- Table columns -- %>
< display:column property ="buType" sort ="false" headerClass ="sortable" titleKey ="ITIL411Form.buType" />
< display:column property ="companyCodes" sort ="false" headerClass ="sortable" titleKey ="ITIL411Form.companyCodes" />
< display:column property ="sequence" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.sequence" />
< display:column property ="companyName" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.companyName" />
<!-- 拠点名 -->
< c:if test ="${editFlg=='true'}" >
< display:column property ="baseName" url ="/ITIL411.html?method=changeWanInfo&actionName=ITIL410&methodName=search" paramId ="lwanConnectMngId" paramProperty ="lwanConnectMngId" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.baseName" />
</ c:if >
< c:if test ="${editFlg=='false'}" >
< display:column property ="baseName" url ="/ITIL411.html?method=viewWanInfo&actionName=ITIL410&methodName=search" paramId ="lwanConnectMngId" paramProperty ="lwanConnectMngId" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.baseName" />
</ c:if >
< display:column property ="lineDivision" sort ="false" headerClass ="sortable" titleKey ="ITIL413Form.lineDivision" />
< display:column property ="lineType" sort ="false" headerClass ="sortable" titleKey ="ITIL413Form.lineType" />
< display:column property ="lanIPaddress" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.lanIPaddress" />
< c:choose >
< c:when test ="${showKiKi == 'true'}" >
< display:column property ="assetTag" url ="/ITIL211.html?method=changeComputerInfo&actionName=ITIL410&methodName=search" paramId ="astId" paramProperty ="lassetId" sort ="false" headerClass ="sortable" titleKey ="ITIL210Form.assetTag" />
</ c:when >
< c:otherwise >
< display:column property ="assetTag" paramProperty ="lassetId" sort ="false" headerClass ="sortable" titleKey ="ITIL210Form.assetTag" />
</ c:otherwise >
</ c:choose >
< display:column property ="biginDayStr" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.biginDay" />
< display:column property ="aboveDayStr" sort ="false" headerClass ="sortable" titleKey ="ITIL410Form.aboveDay" />
< display:setProperty name ="paging.banner.placement" > both </ display:setProperty >
< display:setProperty name ="paging.banner.items_name" value ="" />
< display:setProperty name ="paging.banner.first" >< span class ="pagelinks" > [ < fmt:message key ='ITIL310F.first' /> / < fmt:message key ='ITIL310F.pre' /> ] {0} [ < a href ="{3}" >< fmt:message key ='ITIL310F.next' /></ a > / < a href ="{4}" >< fmt:message key ='ITIL310F.last' /></ a > ] < fmt:message key ='ITIL310F.total' /> < c:out value ="${pageCount}" /></ span ></ display:setProperty >
< display:setProperty name ="paging.banner.last" >< span class ="pagelinks" > [ < a href ="{1}" >< fmt:message key ='ITIL310F.first' /></ a > / < a href ="{2}" >< fmt:message key ='ITIL310F.pre' /></ a > ] {0} [ < fmt:message key ='ITIL310F.next' /> / < fmt:message key ='ITIL310F.last' /> ] < fmt:message key ='ITIL310F.total' /> < c:out value ="${pageCount}" /></ span ></ display:setProperty >
< display:setProperty name ="paging.banner.full" >< span class ="pagelinks" > [ < a href ="{1}" >< fmt:message key ='ITIL310F.first' /></ a > / < a href ="{2}" >< fmt:message key ='ITIL310F.pre' /></ a > ] {0} [ < a href ="{3}" >< fmt:message key ='ITIL310F.next' /></ a > / < a href ="{4}" >< fmt:message key ='ITIL310F.last' /></ a > ] < fmt:message key ='ITIL310F.total' /> < c:out value ="${pageCount}" /></ span ></ display:setProperty >
</ display:table >