当前位置: 技术问答>java相关
在线等待,那位大哥可以解决分页问题,欢迎“心宇”老大来看看
来源: 互联网 发布时间:2017-04-05
本文导语: 在分页时发生如下错误:javax.servlet.ServletException: Result set type is TYPE_FORWARD_ONLY,这是怎么回事???小弟特附上源码,请各位大哥帮忙看看,找找问题。3x!!! | package vod; import java.sql.*;...
在分页时发生如下错误:javax.servlet.ServletException: Result set type is TYPE_FORWARD_ONLY,这是怎么回事???小弟特附上源码,请各位大哥帮忙看看,找找问题。3x!!!
|
package vod;
import java.sql.*;
import java.util.*;
public class PageCt
{
private long l_start; //开始纪录
private long l_end; //结束纪录
private long l_curpage; //当前页数
private long l_totalnum;//总记录数
private int int_num=5; //每页几条
private long l_totalpage; //总的页数
public void Init(long currentpage,long totalnum)
{
l_curpage = currentpage;
l_totalnum = totalnum;
if (currentpage>=0)
{
if (currentpage>=(long)Math.ceil((double)l_totalnum/(double)int_num))
l_curpage = (long)Math.floor((double)l_totalnum/(double)int_num);
else
l_curpage = currentpage;
}
else
{
l_curpage = 0;
}
l_start = l_curpage * int_num;
l_end = l_start + int_num;
if (l_end > l_totalnum)
l_end = l_totalnum;
l_totalpage = (long)Math.ceil((double)l_totalnum/(double)int_num);
}
public long getCurpage()
{
return l_curpage;
}
public long getPrepage()
{
if (l_curpage-1>=0)
{
return l_curpage-1;
}
else
{
return 0;
}
}
public long getNextpage()
{
if (l_curpage+1
import java.sql.*;
import java.util.*;
public class PageCt
{
private long l_start; //开始纪录
private long l_end; //结束纪录
private long l_curpage; //当前页数
private long l_totalnum;//总记录数
private int int_num=5; //每页几条
private long l_totalpage; //总的页数
public void Init(long currentpage,long totalnum)
{
l_curpage = currentpage;
l_totalnum = totalnum;
if (currentpage>=0)
{
if (currentpage>=(long)Math.ceil((double)l_totalnum/(double)int_num))
l_curpage = (long)Math.floor((double)l_totalnum/(double)int_num);
else
l_curpage = currentpage;
}
else
{
l_curpage = 0;
}
l_start = l_curpage * int_num;
l_end = l_start + int_num;
if (l_end > l_totalnum)
l_end = l_totalnum;
l_totalpage = (long)Math.ceil((double)l_totalnum/(double)int_num);
}
public long getCurpage()
{
return l_curpage;
}
public long getPrepage()
{
if (l_curpage-1>=0)
{
return l_curpage-1;
}
else
{
return 0;
}
}
public long getNextpage()
{
if (l_curpage+1