一个非常简单的分页技术MYSQL+JSP 利用了mysql的LIMIT参数
优点:1自己想出来的 2利用了MYSQL 数据库的本身 LIMIT
缺点:现在仅仅实现了 下一个页面功能
<%
int cateID=0;
if(request.getParameter("cateID")==null)
...{cateID=0;}
else...{
cateID=Integer.parseInt(request.getParameter("cateID"));
}
int next_page=cateID+1;
int per_page=5;
int pagenum=(cateID*per_page)+1;
if(cateID==0)...{
sql="select * from BLOG_CONTENT where log_IsTop=0 order by log_ID desc LIMIT 0,"+per_page+" ";
}else...{
sql="select * from BLOG_CONTENT where log_IsTop=0 order by log_ID desc LIMIT "+pagenum+","+per_page+"";
}
rst=stmt.executeQuery(sql);
while(rst.next())...{ %>
<div class="content_head"><img src="images/weather/0.gif" alt="\" align="absmiddle">
<%=rst.getString("log_Title")%> [
<%=rst.getString("log_PostTime")%> |
<br>
<%=rst.getString("log_Content")%><br>
<br>
<%}%>
<div class="content_head" align="right" ><a href="default.jsp">回首页</a> <a href="default.jsp?cateID=<%=next_page%>">下一页</a></div>
<span class="smalltxt"></span></td>
</tr></table>
</td>
</tr>
</table>