日志 >
技术交流
![]()
类分页
![]() import javax.servlet.jsp.tagext.TagSupport; import javax.servlet.jsp.JspWriter; /** * Created by IntelliJ IDEA. * User: qiao * Date: 2008-1-29 * Time: 10:19:40 * To change this template use File | Settings | File Templates. */ public class SearchPageTag extends TagSupport { private int iPageSize = 20; private int iRecordTotal = 0; private String sSubmitFile = ""; private int iCurrPage = 1; private String sSubmitForm = ""; public int iStart = 0;//每一页起始记录号 public int iMax = 0;//每一页结束记录号 private int iPageCount = 0;//页数 public void setsSubmitForm(String sSubmitForm) { this.sSubmitForm = sSubmitForm; } public void setiPageSize(int iPageSize) { this.iPageSize = iPageSize; } public void setiRecordTotal(int iRecordTotal) { this.iRecordTotal = iRecordTotal; } public void setsSubmitFile(String sSubmitFile) { this.sSubmitFile = sSubmitFile; } public void setiCurrPage(int iCurrPage) { this.iCurrPage = iCurrPage; } /** * 设置分页大小 * */ public void setPage() { //计算总页数 if(iRecordTotal % iPageSize >0) { iPageCount = iRecordTotal / iPageSize + 1; } else { iPageCount = iRecordTotal / iPageSize; } if (iPageCount > 0) {//有检索结果 if (iCurrPage <= 0) {//页码为负时 iCurrPage = 1; } if (iCurrPage > iPageCount) {//页码大于总页数时 iCurrPage = iPageCount; } } if (iCurrPage > 1) { //当前页不为1时的起始记录号 iStart = (iCurrPage - 1) * iPageSize; } else { //起始记录号 iStart = 0; } //最大记录号 iMax = iCurrPage * iPageSize; if(iMax > iRecordTotal) { iMax = iRecordTotal; } } public int doStartTag() { setPage(); try { String sUrl = " "; if (iCurrPage == 1) //第一页 { if (iPageCount == 1 || iPageCount == 0) {//只有一页 sUrl = "[首页] [上一页] [下一页] [尾页] "; } else { sUrl = "[首页] [上一页] <a href='#'οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "?currPage=" + (iCurrPage + 1) + "/";" + sSubmitForm + ".submit();'>[下一页]</a> <a href='#'οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "?currPage=" + iPageCount + "/";" + sSubmitForm + ".submit();'>[尾页]</a>"; } } else { if (iCurrPage == iPageCount) //最后一页 { sUrl = "<a href='#'οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "?currPage=1/";" + sSubmitForm + ".submit();'>[首页]</a> <a href='#' οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "?currPage=" + (iCurrPage - 1) + "/";" + sSubmitForm + ".submit();'>[上一页]</a> [下一页] [尾页]"; } else //不是第一页与最后一页 { sUrl = "<a href='#'οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "?currPage=1/";" + sSubmitForm + ".submit();'>[首页]</a> <a href='#'οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "?currPage=" + (iCurrPage - 1) + "/";" + sSubmitForm + ".submit();'>[上一页]</a> <a href='#'οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "?currPage=" + (iCurrPage + 1) + "/";" + sSubmitForm + ".submit();'>[下一页]</a> <a href='#'οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "?currPage=" + iPageCount + "/";" + sSubmitForm + ".submit();'>[尾页]</a> "; } } if (iPageCount <= 0) { iCurrPage = 0; //sUrl+=" 当前第<span align=right class='orangebold'>" + iCurrPage + "/" + iPageCount + "</span>页 直接跳转到第 <input name='currPage' id='currPage' value=/"" + iCurrPage + "/" type='text' size='3'> 页 <img src='../images/button_go.gif' width='25' height='25'οnclick='" + sFormName + ".action=/"" + sSubmitFile + "/";" + sFormName + ".submit(); '>"; } else { if (iCurrPage <= 0) { iCurrPage = 1; } if (iCurrPage > iPageCount) { iCurrPage = iPageCount; } //sUrl+=" 当前第<span align=right class='orangebold'>" + iCurrPage + "/" + iPageCount + "</span>页 直接跳转到第 <input name='currPage' id='currPage' value=/"" + iCurrPage + "/" type='text' size='3'> 页 <img src='../images/button_go.gif' width='25' height='25'οnclick='" + sFormName + ".action=/"" + sSubmitFile + "/";" + sFormName + ".submit(); '>"; } sUrl += " 当前第<span align=right class='orangebold'>" + iCurrPage + "/" + iPageCount + "</span>页 直接跳转到第 <input name='currPage' id='currPage' value=/"" + iCurrPage + "/" type='text' size='3'> 页 <img src='images/button_go.gif' width='25' height='25'οnclick='" + sSubmitForm + ".action=/"" + sSubmitFile + "/";" + sSubmitForm + ".submit(); '>"; JspWriter out = pageContext.getOut(); out.print(sUrl); } catch (Exception ex) { System.out.print("error"); } return (SKIP_BODY); } } ![]() |
评论列表
/x02").replace(//[//quote/]/g,"/x01"); for(var i=0;i<2;i++) s=s.replace(//x03([^/x03/x01/x02]*?)/x02([^/x03/x01/x02]*?)/x01/g, function(a,b,c){ return '
'+b+'引用内容:'; }); return s.replace(/[/x03/x02/x01]/g,""); } var bLoaded = false; function checkMsgReply(obj) { if(!bLoaded) top.includeJS('/qzone/blog/script/common.js', function(){bLoaded=true;checkMsgReply(obj)}, document); else checkReply(obj); if(obj.checked){ MAX_COMMENT_LEN = 500; } else { MAX_COMMENT_LEN = 4500; } _fontCount = MAX_COMMENT_LEN; //字数限制 if(!window.sendCommentEditor) return; if(sendCommentEditor.editorArea.editMode == 1) toCountFont(sendCommentEditor.id, "html"); else toCountFont(sendCommentEditor.id, "text"); } function showMsgLeftCnt() { if(!bLoaded) top.includeJS('/qzone/blog/script/common.js', function(){bLoaded=true;showMsgLeftCnt();}, document); else showLeftSMS(); } function selectBlogPaper() { if(checkLogin() <= 10000) { top.showLoginBox("mall"); return; } if(!!top.g_JData["blogContent"]) { if(parent.g_iLoginUin == parent.g_iUin) { location.href="/qzone/newblog/blogeditor.html?paperid=" + parent.g_JData["blogContent"].data.lp_id + "&paperstyle=" + parent.g_JData["blogContent"].data.lp_style + "&paperdialog=1"; } else { parent.location.href="http://user.qzone.qq.com/" + parent.g_iLoginUin + "/addNewBlog?paperid=" + parent.g_JData["blogContent"].data.lp_id + "&paperstyle=" + parent.g_JData["blogContent"].data.lp_style; } } else { top.showMsgBox("抱歉,暂时无法获取该信纸信息!", 1, 2000); } } /** * 批量删除中选择全选 */ function selectAllComments(bChecked) { var oList = document.getElementsByName("commentCheckBox"); if(oList.length==0) return; for(var i=0; i 0){ dalert(null, parent.g_XDoc["delBatchReply"].xml, 2000); delete parent.g_XDoc["delBatchReply"]; return; } dalert(null, parent.g_XDoc["delBatchReply"].xml, 2000, 2); contentProperty.totalCommentNumber -= nDeleteCnt; //清理cache with(contentProperty){ delete parent.g_XDoc["blogRoot"].contentHSList[currentBlogid]; pageList = {}; pageIndexMap = []; currentCommentPage = lastCommentPage = (!contentProperty.nowaPage)?0:nowaPage[3]; parent.g_XDoc["blogRoot"].replyNumUpdateHSmap[currentBlogid] = totalCommentNumber; parent.isRefreshTop = true; if(currentCommentPage == 0) { setTimeout(contentInit, 1000); } else{ var tp = Math.ceil(totalCommentNumber/PAGE_COMMENT_NUM); var num = totalCommentNumber%PAGE_COMMENT_NUM; if(num==0 || currentCommentPage10000 && top.g_iLoginUin!=top.g_iUin) { $("msgboardSelfReply").style.display = ""; $("blogSelPaper").title = "我也要使用此信纸写日志"; } setTimeout(contentInit,50); //]]> </script>'+c+'
loading......
共2篇评论,第1页/共1页
批量删除 取消批量删除
共2篇评论,第1页/共1页