Code instance: JSP Paging source program

Source: Internet
Author: User

<%@ page contenttype= "text/html charset=gb2312" language= "Java"%>

<%@ Page import = "java.util.*"%>
<%@ page import = "java.io.*"%>
<%@ page import = "java.sql.*" %>
<title> teacher information Query </title>
<style type= "Text/css"
<!--
. Style1 {
 font-family: "XXFarEastFont-Xingkai";
 color: #FFFFFF;
}

</style>
<link href= "Default.css" rel= "stylesheet" type= "text/css"
<style type = "Text/css"
<!--
. style6 {
 color: #000000;
 font-size:24px;
}
. style9 {font-size:24px}

</style>
<body bgcolor= "#ffffff"
& Lt;%session.getattribute ("A_name");%>

<jsp:usebean id= "Tmessgebean" scope= "page" class= "Computer.sqlbean"/>
<table Width= "100%" border= "0" cellpadding= "0" cellspacing= "0",
<tr align= "center" bgcolor= "#00FFFF"
<TD colspan= "5" bgcolor= "#666666" class= "style4" ><div align= "right" ><a href= "index.html" > Return home </ A></div></td>
</tr>
<tr align= "center" bgcolor= "#999999"
  <TD class= "Style4" > </td>
  <TD class= "style4" > Name </td>
  <TD class= "Style4" > Department </td>
  <TD class= "style4" > Professional </td>
  <TD class= "style4" > Operation options </td>
</tr>
<%
request.setcharacterencoding ("gb2312");
int nowpages;//current page
int pages;//request pages
int countperpage = 10;//per page display bars
int pagecount;//total pages
int Recordcount=tmessgebean.getcounter ("SELECT count (*) From Dysf_teacher ");

PageCount = (int) Math.ceil ((RecordCount + countPerPage-1)/countperpage);//Work out the total number of pages
if (Request.getparameter ("pages") = = null) {

pages = 1;
}else{
pages = new Integer (Request.getparameter ("pages")). Intvalue ();
}

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.