How to use Jsp to read Mysql database

Source: Internet
Author: User

<% // Indicates that count is the total number of records
// Page is a user-submitted parameter used to control paging. The allowed values are positive integers and negative integers.
Int I = count/15; // total page, 15 records per page
Int j = I/10; // The total size of the page. If there are no 10 pages, a large page is displayed.
// Page
Int StartPage;
// Int HrefPage;
If (Page <0) Page = 0-Page * 10; // every 10 pages
StartPage = Page/10; // every 10 pages
Out. print ("[total" + I + "Page]");
// Out. print ("Total" + j + "screen ");
// Out. print ("display Page" + Page + "Page ");
// Out. print ("StartPage =" + StartPage );
If (StartPage> 0)
Out. print ("| <a href = \" connectmysql. jsp? Page =-"+ Integer. toString (StartPage-1) +" \ "> Top 10 pages </a> ");
For (int k = 0; k <10; k ++)
{Int p = StartPage * 10 + k;
If (p> I) break;
If (p = Page)
Out. print ("| No." + Integer. toString (p + 1) + "page ");
Else
Out. print ("| <a href = \" connectmysql. jsp? Page = "+ p +" \ "> page" + Integer. toString (p + 1) + "</a> ");
}
If (StartPage <j)
Out. print ("| <a href = \" connectmysql. jsp? Page =-"+ Integer. toString (StartPage + 1) +" \ "> next 10 pages </a> ");
Out. print ("| ");
%>

Related Article

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.