A very simple paging technology MySQL + JSP uses MySQL limit parameters

Source: Internet
Author: User

A very simple paging technologyMySQL+ JSP uses the MySQL limit parameter

Advantages: 1. I figured out 2. I used the MySQL database's own limit.

Disadvantage: only the next page function is implemented.

<%
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.exe cutequery (SQL );
While (RST. Next ()... {%>


<% = RST. getstring ("log_title") %> [

 

<% = RST. getstring ("log_posttime") %> |

<% = RST. getstring ("log_content") %>

<% }%>

Next page on the homepage </div>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.