关于虚拟游戏的小说:jsp分页显示问题??

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 13:50:19
我的一段程序,没加分页时是好的
加了分页后提示如下错误Result set type is TYPE_FORWARD_ONLY
请帮忙看一下

<%
String id=request.getParameter("articleID");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:blog","public","");

Statement stmt = con.createStatement();

String strsel = "select * from article where articleID ="+id;
ResultSet rs1 = stmt.executeQuery (strsel);

%>
<% while(rs1.next())
{
%>
<%= rs1.getString("title")%>
<%= rs1.getString("content")%>
<%
}
rs1.close();

%>

<%

String strse2 = "select * from feedback where articleID ="+id;
ResultSet rs = stmt.executeQuery (strse2);

int dipage=1;//当前页码数默认为1
String pages = request.getParameter("dipage");
if (pages==null)
{
pages="1";
}
try{
dipage =Integer.parseInt(pages);
}
catch(Exception e)
{
dipage=1;
}

int countRecord=0; //记录条数
int countPageRecord=0; //每页记录数
int countPage=0; //总页数
countPageRecord=2;

rs.last();

countRecord=rs.getRow(); //得到总页数
if ( countRecord/countPageRecord==0)
countPage = countRecord/countPageRecord;
else
countPage = countRecord/countPageRecord+1;
if ((dipage-1)*countPageRecord==0)
//rs.afterLast();
rs.beforeFirst();
else
rs.absolute((dipage-1)*countPageRecord);
%>

<%

int i=0;
int feedBackID;
while(rs.next()){

%>

<%= feedBackID = rs.getInt("feedBackID") %>
<%= rs.getString("content") %>

<%
i++;
if (i>=countPageRecord) break; //当前页显示完,则推出循环
%>
<%
}
%>
<%
if(dipage==1)
;
else
{
out.print("<a href =../blog/firstpage.jsp?dipage=1 >首页</a>  ");
out.print("<a href =../blog/firstpage.jsp?dipage="+(dipage-1)+">上一页</a>  ");
}
if (dipage==countPage)
;
else
{
out.print("<a href =../blog/firstpage.jsp?dipage="+(dipage+1)+">下一页</a>  ");
out.print("<a href =../blog/firstpage.jsp?dipage="+countPage+">末页</a> ");
}
%>