<#macro page_table>
<table cellpadding="0" cellspacing="0" border="0" class="pageTable">
<tr>
<td align="left" width="*">
<#nested />
</td>
<td align="right" width="100">
</td>
</tr>
</table>
</#macro>
<#macro page_nav actionUrl page param extra...>
<#assign end=(actionUrl?index_of(".action")) />
<#assign actionName>${actionUrl?substring(0,end)}</#assign>
<form id="${actionName}" name="${actionName}" method="post" action="${actionUrl}">
<input type="hidden" id="pageNo" name="${param}.pageNo" value="" />
<#list extra?keys as attr>
<input type="hidden" name="${attr}" value="${extra[attr]}" />
</#list>
<table border="0" align="left" cellpadding="0" cellspacing="0" width="auto">
<tr>
<td class="pagination">
<div class="pagination_totalCount">第${page.pageNo}页</div>
<#if (page.pageNo gt 1) >
<div class="pagination_index" onclick="coos.form.submit.page('${actionName}','${page.pageNo-1}');">
<span class="arrow"><<</span>
</div>
</#if>
<#if (page.pageNo gt 9)>
<#assign starPage=(page.pageNo - 4) />
<#if ((page.totalPages - page.pageNo)>4)>
<#assign endPage=(page.pageNo + 4) />
<#else>
<#assign endPage=page.totalPages />
</#if>
<#elseif (page.totalPages lt 10)>
<#assign starPage=1 />
<#assign endPage=page.totalPages />
<#else>
<#assign starPage=1 />
<#assign endPage=10 />
</#if>
<#list starPage..endPage as i>
<#if i == page.pageNo>
<div class="pagination_curr" onclick="coos.form.submit.page('${actionName}','${i}');">${i}</div>
<#else>
<div class="pagination_index" onclick="coos.form.submit.page('${actionName}','${i}');">${i}</div>
</#if>
</#list>
<#if (page.pageNo lt page.totalPages) >
<div class="pagination_index" onclick="coos.form.submit.page('${actionName}','${page.pageNo+1}');">
<span class="arrow">>></span>
</div>
</#if>
<div class="pagination_totalCount">共${page.totalPages}页,${page.totalCount}条记录</div>
</td>
</tr>
</table>
</form>
</#macro>
=============
对应css样式
=============
.pagination
{
color: #878787;border: 1px solid #D9D9D4; background: #f7f7f7;cursor: pointer;
height: 20px !important;height: 24px;padding:0px;
}
.pagination_curr
{
color: red;float: left;text-align: center;line-height: 150%;
width: 20px;height: 100%;font-size: 14px;background-color: #ccc;
}
.pagination_index
{
color: black;float: left;text-align: center;
width: 20px;height: 100%;font-size: 14px;line-height: 150%;
}
.pagination_totalCount
{
font-size: 12px;color: black;float: left;text-align: center;line-height: 150%;
padding-top: 2px;padding-left: 5px;padding-right: 5px;
width: auto;height: 18px !important;height: 22px;
}
.paginationLine
{
margin-top:5px;text-align: right;
}
.arrow
{
font-size: 10px;
}
<table cellpadding="0" cellspacing="0" border="0" class="pageTable">
<tr>
<td align="left" width="*">
<#nested />
</td>
<td align="right" width="100">
</td>
</tr>
</table>
</#macro>
<#macro page_nav actionUrl page param extra...>
<#assign end=(actionUrl?index_of(".action")) />
<#assign actionName>${actionUrl?substring(0,end)}</#assign>
<form id="${actionName}" name="${actionName}" method="post" action="${actionUrl}">
<input type="hidden" id="pageNo" name="${param}.pageNo" value="" />
<#list extra?keys as attr>
<input type="hidden" name="${attr}" value="${extra[attr]}" />
</#list>
<table border="0" align="left" cellpadding="0" cellspacing="0" width="auto">
<tr>
<td class="pagination">
<div class="pagination_totalCount">第${page.pageNo}页</div>
<#if (page.pageNo gt 1) >
<div class="pagination_index" onclick="coos.form.submit.page('${actionName}','${page.pageNo-1}');">
<span class="arrow"><<</span>
</div>
</#if>
<#if (page.pageNo gt 9)>
<#assign starPage=(page.pageNo - 4) />
<#if ((page.totalPages - page.pageNo)>4)>
<#assign endPage=(page.pageNo + 4) />
<#else>
<#assign endPage=page.totalPages />
</#if>
<#elseif (page.totalPages lt 10)>
<#assign starPage=1 />
<#assign endPage=page.totalPages />
<#else>
<#assign starPage=1 />
<#assign endPage=10 />
</#if>
<#list starPage..endPage as i>
<#if i == page.pageNo>
<div class="pagination_curr" onclick="coos.form.submit.page('${actionName}','${i}');">${i}</div>
<#else>
<div class="pagination_index" onclick="coos.form.submit.page('${actionName}','${i}');">${i}</div>
</#if>
</#list>
<#if (page.pageNo lt page.totalPages) >
<div class="pagination_index" onclick="coos.form.submit.page('${actionName}','${page.pageNo+1}');">
<span class="arrow">>></span>
</div>
</#if>
<div class="pagination_totalCount">共${page.totalPages}页,${page.totalCount}条记录</div>
</td>
</tr>
</table>
</form>
</#macro>
=============
对应css样式
=============
.pagination
{
color: #878787;border: 1px solid #D9D9D4; background: #f7f7f7;cursor: pointer;
height: 20px !important;height: 24px;padding:0px;
}
.pagination_curr
{
color: red;float: left;text-align: center;line-height: 150%;
width: 20px;height: 100%;font-size: 14px;background-color: #ccc;
}
.pagination_index
{
color: black;float: left;text-align: center;
width: 20px;height: 100%;font-size: 14px;line-height: 150%;
}
.pagination_totalCount
{
font-size: 12px;color: black;float: left;text-align: center;line-height: 150%;
padding-top: 2px;padding-left: 5px;padding-right: 5px;
width: auto;height: 18px !important;height: 22px;
}
.paginationLine
{
margin-top:5px;text-align: right;
}
.arrow
{
font-size: 10px;
}