<#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;
}
分享到:
相关推荐
这是FreeMarker通用的分页
一个用FTL定义的非常通用数据分页指令,有源码,有使用示例。使用效果图可以参看本人博客中的相关文章:http://blog.csdn.net/qjyong/archive/2009/10/18/4693142.aspx
学习freemarker后 发现网上用宏实现分页的例子几乎没有,所以自己写了个。
NULL 博文链接:https://asialee.iteye.com/blog/2062313
这个例子是Freemarker整合Struts2分页,包含了struts2和Freemarker的jar包,可以直接下载导入到Eclipse中运行.
freemarker的分页.数据库是mysql.
最近比较闲,想起来一直没时间做一个好点的分页效果。嗯马上做一个。分页都太熟悉了。以往用的分页都是比较常见的就是上一页,下一页,顶多再加个跳转到第几页。但是有没有好点的效果呢?因为现在一般都用strut2,...
NULL 博文链接:https://zhenghuazhi.iteye.com/blog/1923544
主要就是用servlet做的,freemarker和httpclient的静态化都封装好了工具类了,简单,有文档,可以看懂
freemarker结合struts2分页,在后台接收当前页和每页显示条数即可,其他可按照需求自行更改
Freemarker简介及标签详解大全 Freemarker简介及标签使用说明
里面 集合了 一个 简单的 Freemarker demo 代码 和一个 freemarker 自定义标签代码
freemarker分页,freemarker分页,freemarker分页
freemarker的shiro标签
访问freemarker标签大全:http://www.web-tag.net/all_16.htm freemarker 标签大全 freemarker 标签大全
好用的 freemarker 分页宏模板dom结构比较主流的一个分页一排显示10个分页按钮(想定制的话把页码提取出来做为参数即可)pagenav.previousPage 存着上一页pagenav.totalPage 总页数pagenav.pageNo 当前页面页码page...
FreeMarker标签使用FreeMarker标签使用FreeMarker标签使用FreeMarker标签使用
NULL 博文链接:https://cjb.iteye.com/blog/403878
Spring,Spring Data Jpa,freemarker,bootstrap实现的分页源代码
freemarker实现一行两列算法