TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
<%@ page import="java.sql.*"%>
<%@ page import="java.lang.*"%>
<%@ page contentType="text/HTML;charset=gb2312" %>
<%@ include file="......data.jsp" %>
<jsp:useBean id="PageCount" scope="page"
class="page.PageCt" />
<html>
<head>
<TITLE>测试</TITLE>
<STYLE>
body,table{font-size:9pt}
A:link {
COLOR: #000084; TEXT-DECORATION: none
}
A:visited {
COLOR: #000084; TEXT-DECORATION: none
}
A:hover {
COLOR: black; TEXT-DECORATION: underline
}
.ourfont {
FONT-SIZE: 9pt
}
</STYLE>
</head>
<body bgcolor=#eff3ff>
<center>
<font color=#000084><h3>所有文章分页bean测试</h3></font>
<hr width=600 color=#b5dbff>
<br>
<%
Rst = db.executeQuery("select count(*) from Article" );
Rst.next();
long data_num=Rst.getLong(1);
long Current_Page = 0;
String currentpage=(String)request.getParameter("currentpage");
if (currentpage != null && !currentpage.equals("")){
Current_Page = Integer.parseInt(request.getParameter("currentpage"));
}
String Query_Page=(String)request.getParameter("Query_Page");
if (Query_Page!=null && !Query_Page.equals("")){
Current_Page = Integer.parseInt(request.getParameter("Query_Page"))-1;
}
PageCount.Init(Current_Page,data_num);
long l_start = PageCount.getStart();
long l_end = PageCount.getEnd();
//查询记录
Rst= db.executeQuery("select * from Article " );
long i=0;
while((i<l_start) && Rst.next())
{
i++;
}
//输出查询结果
long j=0;
while(Rst.next() && (i<l_end))
{
j=i+1;
String col1=Rst.getString(1);
String col2 = Rst.getString(2);
String col3 = Rst.getString(3);
String col4 = Rst.getString(4);
String col5 = Rst.getString(5);
String col6 = Rst.getString(6);
String col7 = Rst.getString(7);
String col8 = Rst.getString(8);
String col10=Rst.getString(10);
//打印所显示的数据
out.println("<table border=0 width=600>");
out.println("<tr><td colspan=2><font color=#000084>" + j + "、ID号 "+(col1==null?"":col1)+"</font></td></tr><tr><td colspan=2>资源名:"+(col3==null?"":col3)+"</td></tr>");
out.println("<tr><td> 作者:"+(col4==null?"":col4)+"</td><td> 来源:"+(col5==null?"":col5)+"</td></tr>");
out.println("<tr><td> 类型:"+(col10==null?"":col10)+"</td><td> 时间:"+(col8==null?"":col8)+"</td></tr>");
out.println("</table><br>");
i++;
}
%>
<table width=600><tr bgcolor=#b5dbff>
<form method=GET action=page.jsp>
<td width=80 align=center valign=bottom>共 <%=PageCount.getTotalnum()%> 条</td>
<td width=80 align=center valign=bottom><%=PageCount.getCurpage()+1%>/<%=PageCount.getTotalpage()%> 页</td>
<td width=120 align=center>查看第 <input type=text name=Query_Page size=3> 页</td>
<td width=50 align=center valign=bottom><a href=page.jsp?currentpage=<%=PageCount.getPrepage()%>>上页</a></td>
<td width=50 align=center valign=bottom><a href=page.jsp?currentpage=<%=PageCount.getNextpage()%>>下页</a></td>
</table><br>
<br><br>
<center>
</body>
</html>
<%
Rst.close();
db.freeConnection();
%>
function TempSave(ElementID)
{
CommentsPersistDiv.setAttribute("CommentContent",document.getElementById(ElementID).value);
CommentsPersistDiv.save("CommentXMLStore");
}
function Restore(ElementID)
{
CommentsPersistDiv.load("CommentXMLStore");
document.getElementById(ElementID).value=CommentsPersistDiv.getAttribute("CommentContent");
}
源码下载:http://file.javaxxz.com/2014/10/1/080434328.zip |
|