js| Program | pagination
<%@ page contenttype= "text/html; charset=gb2312 "Language=" Java%>
<%@ page import = "java.util.*"%>
<%@ page import = "java.io.*"%>
<%@ page import = "java.sql.*"%>
<title> Teacher Information Inquiry </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" >
<%session.getattribute ("A_name");%>
<H1 align= "center" class= "Style1 style6 style9" > Teacher Information Inquiry <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" > Teaching No. </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; Show number of bars per page
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 ();
}
if (pages > PageCount) {
Nowpages = 1;
}else{
nowpages = pages;
}
ResultSet rs = tmessgebean.executequery ("select top" + Countperpage +) * FROM Dysf_teacher where ID is not in (select Top +) (nowPages-1) *countperpage + "ID from Dysf_teacher ORDER BY id DESC", ORDER BY id DESC ");
while (Rs.next ()) {
String id = rs.getstring ("id");
String tdepartment = rs.getstring ("department");
String tspecial = rs.getstring ("special");
String tname = rs.getstring ("name");
%>
<tr>
<TD width= "20%" align= "center" ><%= ID%></td>
<TD width= "20%" ><div align= "center" ></div>
<div align= "center" ><%= Tname%></div></td>
<TD width= "20%" ><div align= "center" ></div>
<div align= "center" ><%= tdepartment%></div></td>
<TD width= "20%" ><div align= "center" ></div>
<div align= "center" ><%= tspecial%></div></td>
<TD align= "center" ><a href= "atdelete.jsp?id=<%= ID%>" > Delete </a></td>
</tr>
<%
}
Rs.close ();
%>
<tr align= "Right" >
<TD colspan= "5" > A total of <font color=red><%= recordCount%></font> bar record current <font color=red><% = nowpages%>/<%= PageCount%></font> page
<% if (PageCount > 1) {%>
<% if (pages > 1) {%>
<a href= "" > Home </a>
<%}if (pages < PageCount) {%>
<a href= "? pages=<%= nowpages+1%>" > next page </a>
<%}if (pages!= 1) {%>
<a href= "? pages=<%= nowPages-1%>" > Prev </a>
<%}%>
<a href= "? pages=<%= pagecount%>" > End </a>
<%}%> Jump to
<select name= "Pages" >
<% for (int i=1;i<=pagecount;i++) {%>
<option value= "<%= i%>" <% if (nowpages = i) {%>selected<%}%>><%= I%></option>
<%}%>
</select> page </td>
</tr>
</table>
</body>