67,541
社区成员
发帖
与我相关
我的任务
分享<jsp:useBean id="vedio" scope="page" class="db.dbConn"/>
<%
int PageSize=30;
int Page=1;
int totalPage=1;
int totalrecord=0;
ResultSet vediors=vedio.executeQuery("select count(*) recordcount from vedio");
if(vediors.next())
totalrecord=vediors.getInt("recordcount");
vediors=vedio.executeQuery("select * from vedio order by veid desc");
if(totalrecord%PageSize==0)
totalPage=totalrecord/PageSize;
else
totalPage=(int)Math.floor(totalrecord/PageSize)+1;
if(totalPage==0)totalPage=1;
if(request.getParameter("Page")==null||request.getParameter("Page").equals(""))
Page=1;
else
try
{
Page=Integer.parseInt(request.getParameter("Page"));
}
catch(java.lang.NumberFormatException e){Page=1;}
if(Page<1)
Page=1;
if(Page>totalPage)Page=totalPage;
vediors.absolute((Page-1)*PageSize+1);
%>
<div class="mgdetail">
<table width="700px;" cellpadding="0" cellspacing="0" style="font-size:13px;">
<%
//if(vediors.next()){
int iPage=1;
//while(iPage<=PageSize&&vediors.isAfterLast())
while(iPage<=PageSize&&vediors.next())
{%>
<tr><td width="20px" style="border-bottom:1px dotted #000000;"><img src="images/lt.gif"/></td><td width="400px" style="border-bottom:1px dotted #000000;"><a href="showvedio.jsp?id=<%=vediors.getString("veid")%>"><%=vediors.getString("title")%></a></td><td width="50px" style="border-bottom:1px dotted #000000;"><%=vediors.getString("vhit")%></td><td width="60px" style="border-bottom:1px dotted #000000;"><%=vediors.getString("author")%></td><td width="150px" style="border-bottom:1px dotted #000000;"><%=vediors.getString("vdate")%></td></tr>
<%
if(!vediors.next()) break;
//vediors.next();
iPage++;
}
//}
%>
</table>
</div>
看我的注释就知道我大概尝试过怎么修改!