jsp分页显示问题,急急急!!!各位前辈都来看看啊,先谢谢了
在查询语句中使用条件语句锁定了id
第一页显示正常,但第二页向后就不显示了,为空。其中查询出的符合要求的记录数也正常,就是分页显示不出来
————————————————————————————————————
<%
int i=0,x=0;//计数器
int showrow=8;//每页显示条数
int pages=0;//当前页数
int start; //本页开始条数
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:test","","");//后面参数可为空
Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
String id=request.getParameter("id");
ResultSet rs=st.executeQuery("select retxt,hname from hf where hid="+id+"");
String strp=(String)request.getParameter("pages");
int sig=1,alt;
if(strp==null){sig=1;}else{
for(int i1=0;i1<strp.length();i1++){
alt=strp.charAt(i1);
if(alt<48||alt>57){
sig=1;break;
}else{ sig=2;}
}
}
if(sig==1){pages=1;}else{pages=Integer.parseInt(strp);}
rs.last();
int count=rs.getRow();
int laspc;
int pa=count/showrow;
if(count%showrow>0){pa=pa+1;laspc=count%showrow;}else{laspc=showrow;}
if(pages<0)pages=1;
if(pages>pa)pages=pa;
start=(pages-1)*showrow+1;
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>请您留言</title>
</head>
<body><form name="form1" method="post" action="dell.jsp">
<table width="780" border="0" align="center" cellspacing="0" bgcolor="#f8fff7">
<tr>
<td height="2"></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><div align="center">留言板</div></td>
</tr>
<tr>
<td height="10"><% for(int y=0;y<showrow;y++){%><input name="d<%=y%>" type="hidden" id="a1"><% }%></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="1" bgcolor="#c1d1c1">
<tr>
<td bgcolor="#f8f8f8"><%
%><table width="100%" border="0" cellspacing="0">
<tr>
<td width="41%" class="l"> 第<%=pages%>页 共<%=pa%>页 <% if(pages>1){%>
<a href="show1.jsp">首页</a> <a href="show1.jsp?pages=<%=pages-1%>">上页</a> <% } if(pages<pa){%>
<a href="show1.jsp?pages=<%=pages+1%>">下页</a> <a href="show1.jsp?pages=<%=pa%>">尾页</a> <% }%></td>
<td width="59%" class="l"><div align="right">
<input name="imageField" type="image" src="img/del1.jpg" width="76" height="21" border="0" onMouseOut="this.src='img/del1.jpg'" onMouseOver="this.src='img/del2.jpg'">
<input name="showrow" type="hidden" id="showrow" value="<%=showrow%>">
<input name="pages" type="hidden" id="pages" value="<%=pages%>">
<a href="liuyan.jsp">我要留言</a> </div></td>
</tr>
</table>
<a href="log.jsp"></a></td>
</tr>
</table></td>
<