Java code
package com.;
import com.;
public class PageMaker {
public PageMaker(){}
public String makeList(PageTool pageinfo,String url){
int linkNumber=10;
int halfLinkNumber=5;
String pageStyle="<style> .ptbl {border:1px solid #CEDBEF;font-size:12px;padding:0;font-family:Arial;width:auto} .ptbl a {text-decoration:none;color:#555555} .ptbl td {padding-top:0px;padding-bottom:0px;padding-left:4px;padding-right:4px} .strong {background:#CEDBEF;font-weight:800;color:#FF7D00} .strong a{color:#FF7D00} .page_input {background:#ffffff;border:1px solid #CEDBEF;border-top:none;border-bottom:none;color:#FF7D00;width:30px;margin:0px } </style>";
String pageTable="<table border='0'cellpadding='0' cellspacing='0' bgcolor='#CEDBEF' class='ptbl'><tr align='center' bgcolor='#FFFBFF'>";
//a string that will be decretion to show
StringBuffer pagelist=new StringBuffer("");
//get current page.
int curpage=();
int pagenumber=()/()+1;
//make it's pre,next page
int prepage=curpage-1;
prepage=prepage<=0?1:prepage;
int nextpage=curpage+1;
nextpage=nextpage>=pagenumber?pagenumber:nextpage;
//finger out how many page total
(pageStyle);
(pageTable);
("<td>Record:<font color='red'>"+()+"</font></td>");
//frist page
//("<td><a href='"+url+"1'>|<</a></td>");
//("<td><a href='"+url+prepage+"'><</a></td>");
if (pagenumber<=linkNumber){
for(int i=1;i<=pagenumber;i++){
if(i==curpage)
("<td class='strong'>"+i+"</td>");
else
("<td><a href='"+url+i+"'>"+i+"</a></td>");
}
}else{
int begin=curpage-halfLinkNumber;
begin=(begin<=0)?1:begin;
begin=((halfLinkNumber+curpage)>pagenumber) ? (pagenumber-linkNumber+1):begin;
for(int i=begin;i<=linkNumber+begin-1;i++){
if(i==curpage){
("<td class='strong'>"+i+"</td>");
("\n");
}
else{
("<td><a href='<s:url action='"+url+"'><s:param name='ppp' value='"+i+"'/></s:url>'>"+i+"</a></td>");
("\n");
}
}
}
//("<td><a href='"+url+nextpage+"'>></a></td>");
//("<td><a href='"+url+pagenumber+"'>>|</a></td>");
("<td>Page:<font color='red'>"+pagenumber+"</font></td></tr></table>");
return ();
}
}
package com.;
import com.;
public class PageMaker {
public PageMaker(){}
public String makeList(PageTool pageinfo,String url){
int linkNumber=10;
int halfLinkNumber=5;
String pageStyle="<style> .ptbl {border:1px solid #CEDBEF;font-size:12px;padding:0;font-family:Arial;width:auto} .ptbl a {text-decoration:none;color:#555555} .ptbl td {padding-top:0px;padding-bottom:0px;padding-left:4px;padding-right:4px} .strong {background:#CEDBEF;font-weight:800;color:#FF7D00} .strong a{color:#FF7D00} .page_input {background:#ffffff;border:1px solid #CEDBEF;border-top:none;border-bottom:none;color:#FF7D00;width:30px;margin:0px } </style>";
String pageTable="<table border='0'cellpadding='0' cellspacing='0' bgcolor='#CEDBEF' class='ptbl'><tr align='center' bgcolor='#FFFBFF'>";
//a string that will be decretion to show
StringBuffer pagelist=new StringBuffer("");
//get current page.
int curpage=();
int pagenumber=()/()+1;
//make it's pre,next page
int prepage=curpage-1;
prepage=prepage<=0?1:prepage;
int nextpage=curpage+1;
nextpage=nextpage>=pagenumber?pagenumber:nextpage;
//finger out how many page total
(pageStyle);
(pageTable);
("<td>Record:<font color='red'>"+()+"</font></td>");
//frist page
//("<td><a href='"+url+"1'>|<</a></td>");
//("<td><a href='"+url+prepage+"'><</a></td>");
if (pagenumber<=linkNumber){
for(int i=1;i<=pagenumber;i++){
if(i==curpage)
("<td class='strong'>"+i+"</td>");
else
("<td><a href='"+url+i+"'>"+i+"</a></td>");
}
}else{
int begin=curpage-halfLinkNumber;
begin=(begin<=0)?1:begin;
begin=((halfLinkNumber+curpage)>pagenumber) ? (pagenumber-linkNumber+1):begin;
for(int i=begin;i<=linkNumber+begin-1;i++){
if(i==curpage){
("<td class='strong'>"+i+"</td>");
("\n");
}
else{
("<td><a href='<s:url action='"+url+"'><s:param name='ppp' value='"+i+"'/></s:url>'>"+i+"</a></td>");
("\n");
}
}
}
//("<td><a href='"+url+nextpage+"'>></a></td>");
//("<td><a href='"+url+pagenumber+"'>>|</a></td>");
("<td>Page:<font color='red'>"+pagenumber+"</font></td></tr></table>");
return ();
}
}
Previous page1234567Next pageRead the full text