JAVA JQuery實現非同步分頁

2021-06-09 01:46:43 字數 2576 閱讀 6013

最近乙個專案要求實現非同步分頁,簡單的寫了一下,不好的請指出~

/**

*分頁類

*/public class pagebean

publicvoid setpagecss(string pagecss)

publicstring getpagestyle()

publicvoid setpagestyle(string pagestyle)

publicint getpagepreoffset()

publicvoid setpagepreoffset(intpagepreoffset)

publicint getpagenextoffset()

publicvoid setpagenextoffset(intpagenextoffset)

publicstring getpagedisplay() else else

// 定義向前偏移量

intpreoffset = this.currentpage -1 > this.pagepreoffset ?this.pagepreoffset

:this.currentpage -1;

// 定義向後偏移量

intnextoffset = this.getpagecount() -this.currentpage >this.pagenextoffset ?this.pagenextoffset

:this.getpagecount() -this.currentpage;

// 迴圈顯示鏈結數字,範圍是從 當前頁減向前偏移量 到 當前頁加向後偏移量

for(int i = (this.currentpage - preoffset); i <= (this.currentpage + nextoffset); i++) else

}// 如果當前頁小於總頁數,> >>可用

if(this.currentpage > ");

+"?currentpage=" + (this.getpagecount()) +"'>>> ");

}else

}}else if("normalstyle".equalsignorecase(this.pagestyle)) else else

if(this.currentpage > ");

+"?currentpage=" + (this.getpagecount()) +"'>>> ");

}else }}

"); this.pagedisplay = pagestring.tostring();

returnpagedisplay;

}publicvoid setpagedisplay(string pagedisplay)

publicstring getpageurl()

publicvoid setpageurl(string pageurl)

publicint getpagecount()

publicvoid setpagecount(intpagecount)

publicint getrowcount()

publicvoid setrowcount(introwcount)

publicint getcurrentpage()

publicvoid setcurrentpage(intcurrentpage)

publicint getsizeperpage()

publicvoid setsizeperpage(intsizeperpage)

privatestring getoptions()

returnsb.tostring();

}}

//後台呼叫

實現非同步通訊

實現非同步通訊 1 定義 ajax的核心物件xmlhttprequest xmlhttprequest 是瀏覽器的xmlhttp元件的物件,通過該物件ajax可以像桌面應用程式一樣同伺服器進行資料層面的互動,不需要每次都進行整個頁面的重新整理。2 步驟 1 初始化物件並傳送xmlhttpreques...

BackgroundWorker實現非同步

private void button1 click object sender,eventargs e private void backgroundworker1 dowork object sender,doworkeventargs e this.backgroundworker1.repo...

flask celery redis實現非同步任務

2 搭建目錄 3 啟動專案測試 pip3 install flask pip3 install redis 3.5.3 pip3 install celery 5.0.0 1.2.1 安裝 1 安裝gcc yum install y gccwget tar zxvf redis 5.0.3.tar....