<form method="get" id="frm_search" class="form-inlineheadBar" method="post" action="/messageTaskList.htm">
<input type= "hidden" name="page" id= "page" value="$!page" />
<input type= "hidden" name="pageSize" value= "2" >
<input type= "hidden" name="totalCount" value="$!totalCount" >
</form>
#set( $current_page_num = $paginator.page)
#if(! $current_page_num)
#set($current_page_num = 0)
#end
#set( $itemsPerpage = $paginator.itemsPerPage)
#if(! $itemsPerpage)
#set($itemsPerpage = 0)
#end
#set( $total_page_num = $paginator.getPages())
#if(! $total_page_num)
#set($total_page_num = 0)
#end
#set( $beginIndex = $paginator.beginIndex)
#if(! $beginIndex)
#set($beginIndex = 0)
#end
#set( $endIndex = $paginator.endIndex)
#if(! $endIndex)
#set($endIndex = 0)
#end
#set( $items = $paginator.items)
#if(! $items)
#set($items = 0)
#end
#set( $btn_go_status = "")
#if( $items == 0)
#set($btn_go_status = "disabled")
#end
#set( $tmp_page_num = 0)
#set( $pre_page = 0)
#set( $next_page = 0)
<table class="t-pagination" >
<tr >
<td width= "53%" class="pages" >
#if( $current_page_num > 1)
<span >[ <a href="javascript:gotoPage($!total_page_num, 1)">最前页 </a >] </span >
#else
<span >[最前页] </span >
#end
#if( $current_page_num > 1)
#set( $pre_page = $current_page_num - 1)
<span >[ <a href="javascript:gotoPage($!total_page_num, $pre_page)">上一页 </a >] </span >
#else
<span >[上一页] </span >
#end
#if( $current_page_num < $total_page_num)
#set( $next_page = $current_page_num + 1)
<span > [< a href="javascript:gotoPage($!total_page_num, $next_page)">下一页 </a >] </span >
#else
<span > [下一页]</ span>
#end
#if( $current_page_num < $total_page_num)
<span > [< a href="javascript:gotoPage($!total_page_num, $total_page_num)">最末页 </a >] </span >
#else
<span > [最末页]</ span>
#end
<span > [页数 $current_page_num of $total_page_num]</ span>
#if( $current_page_num > 3 && $total_page_num > 5)
...
#end
#set( $tmp_page_num = $current_page_num - 4)
#if( $tmp_page_num > 0 && $total_page_num - $current_page_num < 1)
<span >[ <a href="javascript:gotoPage($!total_page_num, $!tmp_page_num)">$!tmp_page_num</ a> ]</ span>
#end
#set( $tmp_page_num = $current_page_num - 3)
#if( $tmp_page_num > 0 && $total_page_num - $current_page_num < 2)
<span >[ <a href="javascript:gotoPage($!total_page_num, $!tmp_page_num)">$!tmp_page_num</ a> ]</ span>
#end
#set( $tmp_page_num = $current_page_num - 2)
#if( $tmp_page_num > 0)
<span > [< a href="javascript:gotoPage($!total_page_num, $!tmp_page_num)">$!tmp_page_num</ a> ]</ span>
#end
#set( $tmp_page_num = $current_page_num - 1)
#if( $tmp_page_num > 0)
<span > [< a href="javascript:gotoPage($!total_page_num, $!tmp_page_num)">$!tmp_page_num</ a> ]</ span>
#end
#if( $current_page_num > 0)
<span class="curent-pagenum"> [$current_page_num ]</ span>
#end
#set( $tmp_page_num = $current_page_num + 1)
#if( $tmp_page_num <= $total_page_num)
<span >[ <a href="javascript:gotoPage($!total_page_num, $!tmp_page_num)">$!tmp_page_num</ a> ]</ span>
#end
#set( $tmp_page_num = $current_page_num + 2)
#if( $tmp_page_num <= $total_page_num)
<span >[ <a href="javascript:gotoPage($!total_page_num, $!tmp_page_num)">$!tmp_page_num</ a> ]</ span>
#end
#set( $tmp_page_num = $current_page_num + 3)
#if( $tmp_page_num <= $total_page_num && $current_page_num <= 2)
<span >[ <a href="javascript:gotoPage($!total_page_num, $!tmp_page_num)">$!tmp_page_num</ a> ]</ span>
#end
#set( $tmp_page_num = $current_page_num + 4)
#if( $tmp_page_num <= $total_page_num && $current_page_num <= 1)
<span >[ <a href="javascript:gotoPage($!total_page_num, $!tmp_page_num)">$!tmp_page_num</ a> ]</ span>
#end
#if( $current_page_num + 2 < $total_page_num && $total_page_num > 5)
...
#end
</td >
<td width= "19%"><span class= "font11">跳页: </span >
<input name= "page_num" class="page-num" type= "text" size="3" value="$current_page_num" >
<input type= "button" value="GO" onClick="javascript:gotoPage2($!total_page_num,this.parentNode)" $btn_go_status>
</td >
<td width= "28%">
<div align= "right">显示记录: $!beginIndex - $!endIndex Of $!items </div >
</td >
</tr >
</table>
<script language= "javascript">
function gotoPage(total,pageIndex){
if(pageIndex > total){
pageIndex = total;
}
if(pageIndex < 1){
pageIndex = 1;
}
document.getElementById("page").value = pageIndex;
document.getElementById("frm_search").submit();
}
function gotoPage2(total,tag){
var pageIndex = 1;
pageIndex = tag.getElementsByTagName("input")[0].value.trim();
if(pageIndex > total){
pageIndex = total;
}
if(pageIndex < 1){
pageIndex = 1;
}
document.getElementById("page").value = pageIndex;
document.getElementById("frm_search").submit();
}
</script>
基于velocity的分页组件
最新推荐文章于 2021-02-26 20:51:38 发布