- 浏览: 84417 次
- 性别:
- 来自: 内蒙古
最新评论
-
飞扬云:
楼主,这个文章有个地方好像有误:计算过程: ...
移位运算符 -
zhujyy:
[img][/img][*]引用[u][/u][b][/b][ ...
Java实现MD5加密以及解密类,附带测试类,具体见代码。 -
mingyang2013:
某些好文,不忍心不顶!
sql分组函数使用 -
ccw:
请问:有没有jsp页面吗?
我也在做多图片上传的问题
webwork 多图片上传 -
lengyue_dick:
namelmw 写道
能不能写上注释?我不知道每一个方法及参数 ...
静态化处理模板页
package com.chinabyte.common;
import java.util.Vector;
/**
* 公共的列表
*/
public class CommonList extends Vector {
/**
* 当前页数
*/
public int pageNo;
/**
* 每页显示记录数
*/
public int pageSize;
/**
* 总页数
*/
public int pageNum;
/**
* 总纪录数
*/
public int recNum;
/**
* 开始记录数
*/
public int startPos;
/**
* 结束记录数
*/
public int endPos;
/**
* 默认页大小
*/
public final static int defaultPageSize = 20;
public static final String COMMONLIST_TAG_KEY = "commonlist_tag_key";
public CommonList() {
}
public CommonList(int pageNo, int pageSize) {
if (pageNo < 0) {
pageNo = 0;
}
this.pageNo = pageNo;
this.pageSize = pageSize;
}
/**
* 计算其它属性
* @param recNum 总纪录数
* @param pageNo 当前页
* @param pageSize 页大小
*/
public CommonList(int recNum, int pageNo, int pageSize) {
calculate(recNum, pageNo, pageSize);
}
/**
* 计算其它属性
* @param recNum 总纪录数
*/
public void calculate(int recNum) {
calculate(recNum, pageNo, pageSize);
}
/**
* 计算其它属性
* @param recNum 总纪录数
* @param pageNo 当前页
* @param pageSize 页大小
*/
public void calculate(int recNum, int pageNo, int pageSize) {
if (recNum < 1) return;
if (pageSize == 0) return;
if (pageNo < 1) pageNo = 1;
this.pageNo = pageNo;
this.pageSize = pageSize;
this.recNum = recNum;
if (pageSize > 0) {
if (recNum % pageSize > 0)
pageNum = recNum / pageSize + 1;
else
pageNum = recNum / pageSize;
if (pageNo > pageNum) this.pageNo = pageNum;
if (this.pageNo < 1) this.pageNo = 1;
startPos = (this.pageNo - 1) * pageSize + 1;
endPos = this.pageNo * pageSize;
} else {
startPos = 0;
endPos = recNum;
}
}
/**
* 显示分页标志
* @param cl 列表
* @return 结果
*/
public static String getPage(CommonList cl) {
return getPage(cl, 10, null);
}
/**
* 显示分页标志
* @param cl 列表
* @param pageNum 显示的数目
* @return 结果
*/
public static String getPage(CommonList cl, int pageNum) {
return getPage(cl, pageNum, null);
}
/**
* 显示分页标志
* @param cl 列表
* @param pageNum 显示的数目
* @param strPage 分页参数
* @return 结果
*/
public static String getPage(CommonList cl, int pageNum, String strPage) {
String rValue = null;
StringBuffer sb = new StringBuffer();
try {
if (cl != null) {
if (strPage != null && !strPage.equals(""))
strPage = ",\"" + strPage + "\"";
else
strPage = "";
if (pageNum < 1) pageNum = 10;
sb.append("共有[<font color='#FF0000'>" + cl.recNum + "</font>]条记录," + cl.pageNo + "/" + cl.pageNum + "页。");
if (cl.pageNo > 1) {
sb.append(" <a href='" + strPage + ")'>|<</a> <a href='" + (cl.pageNo - 1) + strPage + ")'><</a>");
}
int currentNum = (cl.pageNo % pageNum == 0 ? (cl.pageNo / pageNum) - 1 : (int) (cl.pageNo / pageNum)) * pageNum;
if (currentNum < 0) currentNum = 0;
if (cl.pageNo > pageNum) sb.append(" <a href='" + (currentNum - pageNum + 1) + strPage + ")'>...</a>");
for (int i = 0; i < pageNum; i++) {
if ((currentNum + i + 1) > cl.pageNum || cl.pageNum < 2) break;
sb.append(" <a href='" + (currentNum + i + 1) + strPage + ")'>" + (currentNum + i + 1 == cl.pageNo ? "<font color='#FF0000'><b>" + (currentNum + i + 1) + "</b></font>" : (currentNum + i + 1) + "") + "</a>");
}
if (cl.pageNum > (currentNum + pageNum)) sb.append(" <a href='" + (currentNum + 1 + pageNum) + strPage + ")'>...</a>");
if (cl.pageNo < cl.pageNum) {
sb.append(" <a href='" + (cl.pageNo + 1) + strPage + ")'>></a> <a href='" + cl.pageNum + strPage + ")'>>|</a>");
}
rValue = sb.toString();
} else {
rValue = "";
}
} catch (Exception e) {
rValue = "";
} finally{
sb = null;
}
// cl = null;
return rValue;
}
public String toString() {
return "com.chinabyte.common.CommonList{" +
"pageNo=" + pageNo +
", pageSize=" + pageSize +
", pageNum=" + pageNum +
", recNum=" + recNum +
", startPos=" + startPos +
", endPos=" + endPos +
"}";
}
/*请保留下面的注释*/
/* js 翻页代码
function tunePage(toPageNo,pageNo) {
try {
var topage = 1;
if(typeof(toPageNo) != "number" || toPageNo < 1) topage = 1;
else topage = toPageNo;
var olds = window.location.searchSubject;
if(typeof(pageNo) == "undefined" || pageNo == "") pageNo = "pageNo";
var news = "";
if(olds.length > 1) {
olds = olds.substring(1,olds.length);
var arrays = olds.split("&");
for (var i = 0; i < arrays.length ; i++)
{
if(arrays[i].indexOf(pageNo + "=") < 0 && arrays[i].length > 1) {
news += "&" + arrays[i];
}
}
if(news.length > 1) {
news = "?" + news.substring(1,news.length) + "&" + pageNo + "=" + topage;
}
else {
news = "?" + pageNo + "=" + topage;
}
}
else {
news = "?" + pageNo + "=" + topage;
}
window.location = window.location.pathname + news;
}
catch(e) {
window.location = window.location.pathname + window.location.searchSubject;
}
}
function sAll(thisObj,dObj) {
try {
var l = eval(dObj + ".length");
if(typeof(l) == "undefined") {
eval(dObj).checked = thisObj.checked;
}
else {
for(var i = 0; i < l; i++) {
if(!eval(dObj + "[" + i + "]").disabled) eval(dObj + "[" + i + "]").checked = thisObj.checked;
}
}
}
catch(e){}
}
*/
}
JSP代码:
CommonList zxcl=db.search(1,"","",phototypename,"" , "" , orderby , ascdesc , pageNo, pageSize);
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="D6E2FF">
<tr>
<form method="get">
<td align="right"><%=CommonList.getPage(cl)%></td>
</form>
</tr>
</table>
DB.JAVA代码:
public CommonList search(int status, String playername, String pictitle, String phototypename, String beginDate, String endDate, String orderby,
String ascdesc, int pageNo, int pageSize)
throws Exception
{
CommonList lst;
Connection conn;
PreparedStatement st;
ResultSet rst;
Exception exception;
lst = null;
StringBuffer buffer = new StringBuffer(1024);
if(status > -1)
buffer.append(" and (status=" + status + ")");
if(playername != null && playername.trim().length() > 0)
buffer.append(" and (playername like '%" + playername + "%')");
if(pictitle != null && pictitle.trim().length() > 0)
buffer.append(" and (pictitle like '%" + pictitle + "%')");
if(phototypename != null && phototypename.trim().length() > 0)
buffer.append(" and (phototypename = '" + phototypename + "')");
if(beginDate != null && beginDate.length() > 0)
buffer.append(" and (inputdate>=to_date('" + beginDate + "','yyyy-mm-dd'))");
if(endDate != null && endDate.length() > 0)
{
endDate = endDate + " 23:59:59";
buffer.append(" and (inputdate<=to_date('" + endDate + "','yyyy-mm-dd HH24:MI:SS'))");
}
String str_orderby = "";
if(orderby != null && orderby.trim().length() > 0)
str_orderby = " order by " + orderby;
else
str_orderby = " order by inputdate ";
if(ascdesc != null && ascdesc.trim().length() > 0)
str_orderby = str_orderby + " " + ascdesc;
else
str_orderby = str_orderby + " desc ";
String wherestr = buffer.length() > 0 ? buffer.replace(1, 5, " where ").toString() : "";
String countSQL = "select count(*) from furniturepicture " + wherestr;
String querySQL = "select * from (select a.*,rownum rowno from (select * from furniturepicture " + wherestr + str_orderby + " ) a) where rowno between ? and ?";
int recordCount = 0;
int pageCount = 0;
conn = null;
st = null;
rst = null;
try
{
conn = Conn.getConnection("search");
conn.setAutoCommit(false);
st = conn.prepareStatement(countSQL);
rst = st.executeQuery();
if(rst.next())
recordCount = rst.getInt(1);
st.close();
st = null;
rst.close();
rst = null;
pageCount = recordCount / pageSize;
if(recordCount % pageSize != 0)
pageCount++;
if(pageNo < 1)
pageNo = 1;
else
if(pageNo > pageCount)
{
pageNo = pageCount;
if(pageNo < 1)
pageNo = 1;
}
lst = new CommonList(recordCount, pageNo, pageSize);
st = conn.prepareStatement(querySQL);
st.setInt(1, pageSize * (pageNo - 1) + 1);
st.setInt(2, pageSize * pageNo);
FurniturePicture obj;
for(rst = st.executeQuery(); rst.next(); lst.add(obj))
{
obj = new FurniturePicture();
obj.setFurniturepictureid(rst.getLong("furniturepictureid"));
obj.setPlayerid(rst.getLong("playerid"));
obj.setPlayername(rst.getString("playername"));
obj.setIdcard(rst.getString("idcard"));
obj.setTel(rst.getString("tel"));
obj.setEmail(rst.getString("email"));
obj.setAddress(rst.getString("address"));
obj.setPassportpin(rst.getString("passportpin"));
obj.setPictitle(rst.getString("pictitle"));
obj.setPicnote(rst.getString("picnote"));
obj.setPhototypeid(rst.getInt("phototypeid"));
obj.setPhototypename(rst.getString("phototypename"));
obj.setHousetype(rst.getString("housetype"));
obj.setPicurl(rst.getString("picurl"));
obj.setMaterialurllist(rst.getString("materialurllist"));
obj.setVotenum(rst.getInt("votenum"));
obj.setHitnum(rst.getInt("hitnum"));
obj.setStatus(rst.getInt("status"));
obj.setInputdate(rst.getString("inputdate"));
}
conn.commit();
}
catch(Exception ex)
{
conn.rollback();
System.out.println("Exception : " + ex.getMessage());
throw ex;
}
finally { }
try
{
conn.setAutoCommit(true);
}
catch(SQLException ex) { }
try
{
if(rst != null)
rst.close();
}
catch(Exception e) { }
try
{
if(st != null)
st.close();
}
catch(Exception e) { }
try
{
Conn.close(conn);
}
catch(Exception e) { }
break MISSING_BLOCK_LABEL_1191;
try
{
conn.setAutoCommit(true);
}
catch(SQLException ex) { }
try
{
if(rst != null)
rst.close();
}
catch(Exception e) { }
try
{
if(st != null)
st.close();
}
catch(Exception e) { }
try
{
Conn.close(conn);
}
catch(Exception e) { }
throw exception;
return lst;
}
import java.util.Vector;
/**
* 公共的列表
*/
public class CommonList extends Vector {
/**
* 当前页数
*/
public int pageNo;
/**
* 每页显示记录数
*/
public int pageSize;
/**
* 总页数
*/
public int pageNum;
/**
* 总纪录数
*/
public int recNum;
/**
* 开始记录数
*/
public int startPos;
/**
* 结束记录数
*/
public int endPos;
/**
* 默认页大小
*/
public final static int defaultPageSize = 20;
public static final String COMMONLIST_TAG_KEY = "commonlist_tag_key";
public CommonList() {
}
public CommonList(int pageNo, int pageSize) {
if (pageNo < 0) {
pageNo = 0;
}
this.pageNo = pageNo;
this.pageSize = pageSize;
}
/**
* 计算其它属性
* @param recNum 总纪录数
* @param pageNo 当前页
* @param pageSize 页大小
*/
public CommonList(int recNum, int pageNo, int pageSize) {
calculate(recNum, pageNo, pageSize);
}
/**
* 计算其它属性
* @param recNum 总纪录数
*/
public void calculate(int recNum) {
calculate(recNum, pageNo, pageSize);
}
/**
* 计算其它属性
* @param recNum 总纪录数
* @param pageNo 当前页
* @param pageSize 页大小
*/
public void calculate(int recNum, int pageNo, int pageSize) {
if (recNum < 1) return;
if (pageSize == 0) return;
if (pageNo < 1) pageNo = 1;
this.pageNo = pageNo;
this.pageSize = pageSize;
this.recNum = recNum;
if (pageSize > 0) {
if (recNum % pageSize > 0)
pageNum = recNum / pageSize + 1;
else
pageNum = recNum / pageSize;
if (pageNo > pageNum) this.pageNo = pageNum;
if (this.pageNo < 1) this.pageNo = 1;
startPos = (this.pageNo - 1) * pageSize + 1;
endPos = this.pageNo * pageSize;
} else {
startPos = 0;
endPos = recNum;
}
}
/**
* 显示分页标志
* @param cl 列表
* @return 结果
*/
public static String getPage(CommonList cl) {
return getPage(cl, 10, null);
}
/**
* 显示分页标志
* @param cl 列表
* @param pageNum 显示的数目
* @return 结果
*/
public static String getPage(CommonList cl, int pageNum) {
return getPage(cl, pageNum, null);
}
/**
* 显示分页标志
* @param cl 列表
* @param pageNum 显示的数目
* @param strPage 分页参数
* @return 结果
*/
public static String getPage(CommonList cl, int pageNum, String strPage) {
String rValue = null;
StringBuffer sb = new StringBuffer();
try {
if (cl != null) {
if (strPage != null && !strPage.equals(""))
strPage = ",\"" + strPage + "\"";
else
strPage = "";
if (pageNum < 1) pageNum = 10;
sb.append("共有[<font color='#FF0000'>" + cl.recNum + "</font>]条记录," + cl.pageNo + "/" + cl.pageNum + "页。");
if (cl.pageNo > 1) {
sb.append(" <a href='" + strPage + ")'>|<</a> <a href='" + (cl.pageNo - 1) + strPage + ")'><</a>");
}
int currentNum = (cl.pageNo % pageNum == 0 ? (cl.pageNo / pageNum) - 1 : (int) (cl.pageNo / pageNum)) * pageNum;
if (currentNum < 0) currentNum = 0;
if (cl.pageNo > pageNum) sb.append(" <a href='" + (currentNum - pageNum + 1) + strPage + ")'>...</a>");
for (int i = 0; i < pageNum; i++) {
if ((currentNum + i + 1) > cl.pageNum || cl.pageNum < 2) break;
sb.append(" <a href='" + (currentNum + i + 1) + strPage + ")'>" + (currentNum + i + 1 == cl.pageNo ? "<font color='#FF0000'><b>" + (currentNum + i + 1) + "</b></font>" : (currentNum + i + 1) + "") + "</a>");
}
if (cl.pageNum > (currentNum + pageNum)) sb.append(" <a href='" + (currentNum + 1 + pageNum) + strPage + ")'>...</a>");
if (cl.pageNo < cl.pageNum) {
sb.append(" <a href='" + (cl.pageNo + 1) + strPage + ")'>></a> <a href='" + cl.pageNum + strPage + ")'>>|</a>");
}
rValue = sb.toString();
} else {
rValue = "";
}
} catch (Exception e) {
rValue = "";
} finally{
sb = null;
}
// cl = null;
return rValue;
}
public String toString() {
return "com.chinabyte.common.CommonList{" +
"pageNo=" + pageNo +
", pageSize=" + pageSize +
", pageNum=" + pageNum +
", recNum=" + recNum +
", startPos=" + startPos +
", endPos=" + endPos +
"}";
}
/*请保留下面的注释*/
/* js 翻页代码
function tunePage(toPageNo,pageNo) {
try {
var topage = 1;
if(typeof(toPageNo) != "number" || toPageNo < 1) topage = 1;
else topage = toPageNo;
var olds = window.location.searchSubject;
if(typeof(pageNo) == "undefined" || pageNo == "") pageNo = "pageNo";
var news = "";
if(olds.length > 1) {
olds = olds.substring(1,olds.length);
var arrays = olds.split("&");
for (var i = 0; i < arrays.length ; i++)
{
if(arrays[i].indexOf(pageNo + "=") < 0 && arrays[i].length > 1) {
news += "&" + arrays[i];
}
}
if(news.length > 1) {
news = "?" + news.substring(1,news.length) + "&" + pageNo + "=" + topage;
}
else {
news = "?" + pageNo + "=" + topage;
}
}
else {
news = "?" + pageNo + "=" + topage;
}
window.location = window.location.pathname + news;
}
catch(e) {
window.location = window.location.pathname + window.location.searchSubject;
}
}
function sAll(thisObj,dObj) {
try {
var l = eval(dObj + ".length");
if(typeof(l) == "undefined") {
eval(dObj).checked = thisObj.checked;
}
else {
for(var i = 0; i < l; i++) {
if(!eval(dObj + "[" + i + "]").disabled) eval(dObj + "[" + i + "]").checked = thisObj.checked;
}
}
}
catch(e){}
}
*/
}
JSP代码:
CommonList zxcl=db.search(1,"","",phototypename,"" , "" , orderby , ascdesc , pageNo, pageSize);
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="D6E2FF">
<tr>
<form method="get">
<td align="right"><%=CommonList.getPage(cl)%></td>
</form>
</tr>
</table>
DB.JAVA代码:
public CommonList search(int status, String playername, String pictitle, String phototypename, String beginDate, String endDate, String orderby,
String ascdesc, int pageNo, int pageSize)
throws Exception
{
CommonList lst;
Connection conn;
PreparedStatement st;
ResultSet rst;
Exception exception;
lst = null;
StringBuffer buffer = new StringBuffer(1024);
if(status > -1)
buffer.append(" and (status=" + status + ")");
if(playername != null && playername.trim().length() > 0)
buffer.append(" and (playername like '%" + playername + "%')");
if(pictitle != null && pictitle.trim().length() > 0)
buffer.append(" and (pictitle like '%" + pictitle + "%')");
if(phototypename != null && phototypename.trim().length() > 0)
buffer.append(" and (phototypename = '" + phototypename + "')");
if(beginDate != null && beginDate.length() > 0)
buffer.append(" and (inputdate>=to_date('" + beginDate + "','yyyy-mm-dd'))");
if(endDate != null && endDate.length() > 0)
{
endDate = endDate + " 23:59:59";
buffer.append(" and (inputdate<=to_date('" + endDate + "','yyyy-mm-dd HH24:MI:SS'))");
}
String str_orderby = "";
if(orderby != null && orderby.trim().length() > 0)
str_orderby = " order by " + orderby;
else
str_orderby = " order by inputdate ";
if(ascdesc != null && ascdesc.trim().length() > 0)
str_orderby = str_orderby + " " + ascdesc;
else
str_orderby = str_orderby + " desc ";
String wherestr = buffer.length() > 0 ? buffer.replace(1, 5, " where ").toString() : "";
String countSQL = "select count(*) from furniturepicture " + wherestr;
String querySQL = "select * from (select a.*,rownum rowno from (select * from furniturepicture " + wherestr + str_orderby + " ) a) where rowno between ? and ?";
int recordCount = 0;
int pageCount = 0;
conn = null;
st = null;
rst = null;
try
{
conn = Conn.getConnection("search");
conn.setAutoCommit(false);
st = conn.prepareStatement(countSQL);
rst = st.executeQuery();
if(rst.next())
recordCount = rst.getInt(1);
st.close();
st = null;
rst.close();
rst = null;
pageCount = recordCount / pageSize;
if(recordCount % pageSize != 0)
pageCount++;
if(pageNo < 1)
pageNo = 1;
else
if(pageNo > pageCount)
{
pageNo = pageCount;
if(pageNo < 1)
pageNo = 1;
}
lst = new CommonList(recordCount, pageNo, pageSize);
st = conn.prepareStatement(querySQL);
st.setInt(1, pageSize * (pageNo - 1) + 1);
st.setInt(2, pageSize * pageNo);
FurniturePicture obj;
for(rst = st.executeQuery(); rst.next(); lst.add(obj))
{
obj = new FurniturePicture();
obj.setFurniturepictureid(rst.getLong("furniturepictureid"));
obj.setPlayerid(rst.getLong("playerid"));
obj.setPlayername(rst.getString("playername"));
obj.setIdcard(rst.getString("idcard"));
obj.setTel(rst.getString("tel"));
obj.setEmail(rst.getString("email"));
obj.setAddress(rst.getString("address"));
obj.setPassportpin(rst.getString("passportpin"));
obj.setPictitle(rst.getString("pictitle"));
obj.setPicnote(rst.getString("picnote"));
obj.setPhototypeid(rst.getInt("phototypeid"));
obj.setPhototypename(rst.getString("phototypename"));
obj.setHousetype(rst.getString("housetype"));
obj.setPicurl(rst.getString("picurl"));
obj.setMaterialurllist(rst.getString("materialurllist"));
obj.setVotenum(rst.getInt("votenum"));
obj.setHitnum(rst.getInt("hitnum"));
obj.setStatus(rst.getInt("status"));
obj.setInputdate(rst.getString("inputdate"));
}
conn.commit();
}
catch(Exception ex)
{
conn.rollback();
System.out.println("Exception : " + ex.getMessage());
throw ex;
}
finally { }
try
{
conn.setAutoCommit(true);
}
catch(SQLException ex) { }
try
{
if(rst != null)
rst.close();
}
catch(Exception e) { }
try
{
if(st != null)
st.close();
}
catch(Exception e) { }
try
{
Conn.close(conn);
}
catch(Exception e) { }
break MISSING_BLOCK_LABEL_1191;
try
{
conn.setAutoCommit(true);
}
catch(SQLException ex) { }
try
{
if(rst != null)
rst.close();
}
catch(Exception e) { }
try
{
if(st != null)
st.close();
}
catch(Exception e) { }
try
{
Conn.close(conn);
}
catch(Exception e) { }
throw exception;
return lst;
}
发表评论
-
Java实现MD5加密以及解密类,附带测试类,具体见代码。
2009-12-01 10:20 8808MD5加密解密类——MyMD5Util,代码如下: ... -
动态读取配置文件类
2009-08-01 15:49 1105package cn.dick.util; import j ... -
Java复制和删除文件
2009-05-18 10:19 1094import java.io.*; public ... -
静态化处理模板页
2008-10-10 17:45 1815先做个静太的模板页,然后用下面这个类去读取它 Read ... -
功能更强的分页
2008-09-28 10:28 955抽象类 =========================== ... -
JAVA分页代码实例
2008-09-27 09:34 7039package com.hjf.web.view; publ ...
相关推荐
本资源提供了一个完整的Java分页代码实现,包括注释,非常适合初学者学习和实践。 分页的核心原理是通过查询数据库时限制返回结果的数量,同时提供一个偏移量来指定从哪一条数据开始获取。在Java中,我们可以使用...
本资源提供了一套非常优秀的Java分页代码,它旨在简化开发过程,使得开发者能够轻松地在应用程序中实现分页功能。 分页的基本原理是将大量的数据集分割成较小的部分,每次只加载一部分数据到内存中,用户可以逐页...
虽然这里的代码示例采用的是ASP.NET的语法结构,但我们可以从中抽取出与Java分页相关的概念和技术要点,并结合Java环境进行阐述。 ### Java分页原理 分页是一种在数据量较大的情况下对数据进行分割展示的技术手段...
【JAVA分页代码宝典】是关于在Java编程中实现分页功能的详细指南,它提供了全面的示例代码和技巧。在Web开发中,分页是必不可少的,特别是处理大量数据时,为了提高用户体验,通常需要将结果分成多个页面显示。本篇...
java分页代码汇集
在Java编程中,分页是数据管理中一个重要的概念,特别是在处理大数据集时,它可以提高应用性能并优化用户体验。分页允许用户逐步加载和查看大量数据,而不是一次性加载所有数据,这有助于降低服务器负载和内存消耗。...
总结起来,这个 Java 分页代码示例展示了如何使用 DAO 模式、存储过程和 JSP 进行数据库数据的分页处理。这种设计使得应用程序能够有效地处理大量数据,同时提供用户友好的浏览体验。在实际项目中,还需要考虑更多的...
java中分页功能的实现.直接调用即可.这个插件的原理就是你只要给他一个需要分页的集合,分页数,每页条数,然后在回调函数中返回总条数,当前页码,每页数据集合,每页条数,后台只需要调用即可。
JSF在网页上显示大型数据时的分页代码,测试可用。需要自行定义标签。
在Java Web开发中,SSH(Struts2、Hibernate、Spring)框架是一个常见的组合,用于构建高效、可维护的Web应用程序。SSH框架集成了MVC设计模式、对象关系映射(ORM)以及依赖注入(DI)和面向切面编程(AOP)。在本...
显示效果: [页面总数小于等于10,全部显示,当前页特殊显示] 上一页 1 2 3 4 5 6 7 8 9 10 下一页 [页面总数大于10,部分显示,当前页特殊显示] 上一页 1 2 3 … 20 下一页 [当前页面为首页时,上一页不可用] ...
java封装好的分页代码
总结起来,这个Java分页代码设计简洁,具有很好的灵活性,可以根据不同的应用场景进行扩展。它通过`JdbcTemplate`与数据库交互,既可以一次性加载数据后分页,也可以按需从数据库获取数据,适应性强。同时,通过`...
接着,Java分页通常与数据库操作紧密相关,因此我们需要了解SQL的分页查询。在MySQL等关系型数据库中,可以使用LIMIT和OFFSET关键字实现分页。例如,如果我们想获取第2页,每页10条的数据,SQL语句可能如下: ```...
Java万能分页代码是Java开发中常用的工具,尤其在处理大数据量的Web应用时,分页技术能够显著提升用户体验并优化服务器性能。这个3.0版本的分页代码库通常包含了一些经过优化的分页算法和接口,适用于各种场景,如...
在Java编程中,分页是一种常见的数据处理方式,特别是在Web应用中,当需要展示大量数据时,分页可以提高用户体验,避免一次性加载过多的数据导致页面响应变慢。本实例主要展示了如何在Java中实现一个简单的分页工具...
实现分页功能是各个页面显示的内容数量一样