我的分页程序错在哪???
<%@ page import="beans.db,beans.tranChinese,java.sql.*"%>
<jsp:useBean id="mydb" scope="page" class="beans.db" />
<jsp:useBean id="tocn" scope="page" class="beans.tranChinese" />
<%@ page language="java"%>
<%@ page contentType="text/html;charset=gb2312"%>
<Html>
<Head>
<Title> 搜索结果 </Title>
<Head>
<Body>
<%
ResultSet rs=null;
String student_name="",sql0="";
student_name = tocn.toChinese(request.getParameter("student_name").trim());
%>
<form action="scoreQuery.jsp" name="student_selected" method="post">
<BR><BR>
<table width="80%" border="2" style="border-collapse: collapse" bordercolor="#A2C0FF" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor="#73B5FF">
<td colspan="4" height="25" bgcolor="#73B599">
<div align="center"><font size="4pt"><b>搜 索 结 果</b></font></div>
</td>
<tr>
<tr bgcolor="#6699FF">
<td width="5%" height="25" bgcolor="#73B5FF">
<div align="center"></div>
</td>
<td width="25%" height="25" bgcolor="#73B5FF">
<div align="center"><b><font color="#FFFFFF">姓 名</font></b></div>
</td>
<td width="30%" height="25" bgcolor="#73B5FF">
<div align="center"><b><font color="#FFFFFF">部 门</font></b></div>
</td>
<td width="40%" height="25" bgcolor="#73B5FF">
<div align="center"><b><font color="#FFFFFF">E-Mail</font></b></div>
</td>
</tr>
<%
int i=0;
int intPageSize; //每页显示条数
int intRowCount; //总条数
int intPageCount;//总页数
int intPage; //显示页数
java.lang.String strPage;
intPageSize = 20;
strPage = request.getParameter("page");
if(strPage==null)
{
intPage = 1;
}
else
{
intPage = java.lang.Integer.parseInt(strPage);
if(intPage<1) intPage = 1;
}
if(student_name.equals("*"))
{
sql0="select oid,common_name,department_number,email_address from usr";
}
else
{
sql0="select oid,common_name,department_number,email_address from usr where common_name like '%"+student_name+"%'";
}
rs=mydb.executeQuery(sql0);
//rs.beforeFirst();
rs.last();
intRowCount = rs.getRow(); //获取记录总数
rs.beforeFirst();
intPageCount = (intRowCount+intPageSize-1)/intPageSize; //计算总页数
if(intPage>intPageCount) intPage = intPageCount; //调整待显示的页码
if(intPageCount>0)
{ //将记录指针定位到待显示页的第一条记录上
rs.absolute((intPage-1) * intPageSize + 1);
i = 0;
while(i<intPageSize && !rs.isAfterLast())
{
student_name=rs.getString("common_name");
%>
<tr bgcolor="#EFF7FF">
<td width="5%" height="23">
<div align="center">
<input type="checkbox" name="checkbox1" value="<%=rs.getString("oid")%>">
</div>
</td>
<td width="25%" height="23">
<div align="left"><%=student_name%></div>
</td>
<td width="30%" height="23">
<div align="left"><%=rs.getString("department_number")%></div>
</td>
<td width="40%" height="23">
<div align="left"><%=rs.getString("email_address")%></div>
</td>
</tr>
<%
rs.next();
i++;
}
}
%>
<tr>
<td colspan="4" height="25" bgcolor="#73B5FF">
<div align="right">[第<%=intPage%>页/共<%=intPageCount%>页]<%
if(intPage<intPageCount){%><a href="studentShow.jsp?page=<%=intPage+1%>">[下一页]</a><%}
if(intPage>1){%><a href="studentShow.jsp?page=<%=intPage-1%>">[上一页]</a><%}%>
</div>
</td>
</tr>
<tr>
<td colspan="4" height="25" bgcolor="#73B5FF">
<div align="center"><input type="submit" value="确 定"></div>
</td>
</tr>
</Table>
</form>
</Body>
</Html>
<%
rs.close();
mydb.release();
%>