首页 > 代码库 > ResultSet取结果集多少条记录方法及分页概要

ResultSet取结果集多少条记录方法及分页概要

		allst=toconn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);		allsql = "SELECT distinct docid,docchannel FROM isimportant where docchannel=‘"+CHANNELID+"‘";				allrs=allst.executeQuery(allsql);		allrs.last();		int recordcount=allrs.getRow();		allrs.beforeFirst();			int pagesize;		pagesize=12;		int pagecount;		if(recordcount%pagesize!=0)			pagecount=recordcount/pagesize+1;		else			pagecount=recordcount/pagesize;			if(pagecount==0)			pagecount=1;	    int topage=1;		String strtopage=request.getParameter("topage");		if (strtopage==null)		{			topage=1;		}		else		{			topage=Integer.parseInt(strtopage);		}		if(pagecount<=0)			pagecount=1;		if(topage<=0)			topage=1;		if(topage>pagecount)			topage=pagecount;		if(topage>1)			allrs.absolute(pagesize*(topage-1));		String iscount="";		while(allrs.next()&&isum<pagesize){........}///////////////分页<ul class="pagination">	                 <%		   						if( topage > 1)					{				%>            				<li><a href="http://www.mamicode.com/manager/mmain.jsp?topage=1&CHANNELID=" class="">首页</a></li>               				<li><a href="http://www.mamicode.com/manager/mmain.jsp?topage=&CHANNELID=" class="">上一页</a></li> 				<%					}					else					{				%>     										<li class="previous disabled"><a class="">首页</a></li> 										<li class="previous disabled"><a class="">上一页</a></li> 														<%					}					if(topage<pagecount)					{				%> 											<li><a>当前第<%=topage%>页</a></li> <li><a href="http://www.mamicode.com/manager/mmain.jsp?topage=&CHANNELID=" class="">下一页</a></li> 										<li><a href="http://www.mamicode.com/manager/mmain.jsp?topage=&CHANNELID=" class="">尾页</a></li> 										<li><a> 共 <%=pagecount%> 页</a></li>				<%					}				  else					{				%>										<li><a>当前第<%=topage%>页</a></li> 										<li class="next disabled"><a >下一页</a></li> 										<li class="next disabled"><a >尾页</a></li> 										<li><a>  共 <%=pagecount%> 页</a></li>				<%					}				%>		</ul>

 

ResultSet取结果集多少条记录方法及分页概要