?? page.java
字號:
package com.yuanchung.sales.util;
import java.util.List;
public class Page {
private int currentPage;// 當前頁碼
private int rowsPerPage;// 每頁記錄數
private String path;// 請求路徑
private int allCount;// 總記錄數
private List list;// 數據
public Page(String path, int allCount, int currentPage, int rowsPerPage,
List mmList) {
this.path = path;
this.allCount = allCount;
this.currentPage = currentPage;
this.rowsPerPage = rowsPerPage;
this.list = mmList;
}
public int getAllCount() {
return allCount;
}
public void setAllCount(int allCount) {
this.allCount = allCount;
}
public int getRowsPerPage() {
return rowsPerPage;
}
public void setRowsPerPage(int rowsPerPage) {
this.rowsPerPage = rowsPerPage;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public int getAllPage() {
return (this.allCount - 1) / this.rowsPerPage + 1;
}
public String getPageBar(){
StringBuffer bar = new StringBuffer();
bar.append("<%@ page language='java' pageEncoding='UTF-8'%>");
bar.append("<div class='tableHead'>");
if(this.currentPage<=1){
bar.append("首頁 上頁");
}else{
bar.append("<a href=\""+path+"¤tPage=1\">首頁</a> ");
bar.append("<a href=\""+path+"¤tPage="+(this.currentPage-1)+"\">上頁</a>");
}
bar.append(" <select name=\"xx\" onchange=\"forward(this.value)\">");
for(int i=1;i<=this.getAllPage();i++){
if(i==this.currentPage){
bar.append("<option value='"+i+"' selected>"+i+"/"+this.getAllPage()+"</option>");
}else{
bar.append("<option value='"+i+"'>"+i+"/"+this.getAllPage()+"</option>");
}
}
bar.append("</select></span> ");
if(this.currentPage>=this.getAllPage()){
bar.append("下頁 尾頁");
}else{
bar.append("<a href=\""+path+"¤tPage="+(this.currentPage+1)+"\">下頁</a> ");
bar.append("<a href=\""+path+"¤tPage="+(this.getAllPage())+"\">尾頁</a>");
}
bar.append("<span align=\"left\" style='margin-left:10px'>每頁"+this.rowsPerPage+"條/共"+this.getAllPage()+"頁 共"+this.allCount+"條</span></div>");
bar.append("<script>");
bar.append("function forward(page){");
bar.append(" location.href='"+path+"¤tPage='+page;");
bar.append("}");
bar.append("</script>");
return bar.toString();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -