放到ArrayList中,用它的size()方法可以知道有多少条记录了.
至于几页 一除就知道了.
至于几页 一除就知道了.
解决方案 »
- 小项目。每天同时有80多个用户同时访问
- 前辈们不要路过啊,帮帮忙……
- 在Tomcat作为服务器,为什么用不了fso = new ActiveXObject("Scripting.FileSystemObject");
- jsp中怎么显示blob类型的内容,包括图片和文字 ,数据库用得mysql
- struts导出excel问题,请教各位,先谢谢了!!!!!!!!!
- jsp连接sql2000
- Action传参给Jsp页面问题
- turbine问题:请问在screen下面增加了一个HelloWorld.vm文件,我应该访问什么地址才能够看到HelloWorld.vm的内容?
- 在Struts中,如何实现多个struts-config.xml配置?
- HttpServletRequest类,如何得到请求得绝对路径?(在线等待)
- 問兩個基本問題: random()及記錄數.....
- 标志处理器和JeanBean在jsp页面中使用
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page language="java" %>
<%@ page import="Common.*" %>
<%@ page import="SiEnterpriseExam.*" %>
<jsp:useBean id="checkdata" class="Common.CheckData" scope="page" />
<jsp:useBean id="user" class="Simis.User" scope="session" />
<jsp:useBean id="arraytable" class="Common.ArrayTable" scope="page" />
<%if ((!user.isLogin())||(Integer.valueOf(user.getRight()).intValue()!=1)) {%>
<jsp:include page="index.jsp" flush="true" />
<%} else {%>
<%!
int PageSize = 1; //设置每张网页显示两笔记录
int ShowPage = 1; //设置欲显示的页数
int RowCount = 0; //ResultSet的记录笔数
int PageCount = 0; //ResultSet分页后的总页数
CodeTable codeTable = null;
String strSQL = "select distinct * from sinetac01,sinetac02 where sinetac01.personflow=sinetac02.personflow AND sinetac01.checkflag='0' ";String str = null;
ResultSet rs = null;
DBSQL_Exam db_Exam = new DBSQL_Exam();
%><%
//取得查询条件
strSQL = "select distinct * from sinetac01,sinetac02 where sinetac01.personflow=sinetac02.personflow AND sinetac01.checkflag='0' ";
if(str == null && request.getParameter("unname") == null)
{
str = "";
strSQL = "select distinct * from sinetac01,sinetac02 where sinetac01.personflow=sinetac02.personflow AND sinetac01.checkflag='0' ";
}
else if(request.getParameter("unname")!= null)
{ if(!str.equals(request.getParameter("unname")))
{
str = request.getParameter("unname");
strSQL += "AND sinetac01.aab001= '" + str + "' ";
}
else if(str.equals(request.getParameter("unname")) && str == "")
strSQL = "select distinct * from sinetac01,sinetac02 where sinetac01.personflow= sinetac02.personflow AND sinetac01.checkflag='0' ";
else
{
strSQL = "select distinct * from sinetac01,sinetac02 where sinetac01.personflow= sinetac02.personflow AND sinetac01.checkflag='0' ";
strSQL += "AND sinetac01.aab001= '" + str + "' ";
}
}
else
{
str = "";
strSQL = "select distinct * from sinetac01,sinetac02 where sinetac01.personflow= sinetac02.personflow AND sinetac01.checkflag='0' ";
}try{
strSQL += "order by sinetac02.netdeclaredate";
db_Exam.openQueryDB();
rs = db_Exam.executeQuery(strSQL);
rs.last(); //将指标移至最后一笔记录
RowCount = rs.getRow(); //取得ResultSet中记录的笔数
//计算显示的页数
PageCount = ((RowCount % PageSize) == 0 ?
(RowCount/PageSize) : (RowCount/PageSize)+1);
codeTable = db_Exam.getCodeTable("SiEnterprise_Exam"); }
catch(Exception ex)
{
System.out.println(ex.toString());
%><%}%>
<%
String ToPage = request.getParameter("ToPage");
if(ToPage != null) //判断是否可正确取得ToPage参数
{
ShowPage = Integer.parseInt(ToPage); //取得指定显示的分页页数
if(ShowPage > PageCount) //下面的if语句将判断用户输入的页数是否正确
{
ShowPage = PageCount; //判断指定页数是否大于总页数, 是则设置显示最后一页
}
else if(ShowPage <= 0)
{
ShowPage = 1; //若指定页数小于0, 则设置显示第一页的记录
}
}
if(ShowPage >0)
rs.absolute((ShowPage - 1) * PageSize + 1); //计算欲显示页的第一笔记录位置
%><script>
function YearNull() {
thisform.unname.value="";
}
function YearNull1() {
if(document.thisform.unname.value == "")
{
alert("请输入查询单位编号");
document.thisform.unname.focus();
}
else
{
document.thisform.action="exam_new.jsp?ToPage=1";
document.thisform.submit();
}
}function keydown()
{
var whichkey = event.keyCode;
if (whichkey == 13||whichkey == 10)
{
if(document.thisform.ToPage.value == "")
{
document.thisform.ToPage.focus();
return;
}
else
document.thisform.submit();
}
}
function keydown1()
{
var whichkey = event.keyCode;
if (whichkey == 13||whichkey == 10)
{
document.thisform.action="exam_new.jsp?ToPage=1";
document.thisform.submit();
}
}
function PageDown()
{
document.thisform.action = "exam_new.jsp?ToPage="+"<%= ShowPage + 1 %>";
document.thisform.submit();}
function PageUp()
{
document.thisform.action = "exam_new.jsp?ToPage="+"<%= ShowPage - 1 %>";
document.thisform.submit();}
function PageFirst()
{
document.thisform.action = "exam_new.jsp?ToPage="+"<%= 1 %>";
document.thisform.submit();
}
function PageLast()
{
document.thisform.action = "exam_new.jsp?ToPage="+"<%= PageCount %>";
document.thisform.submit();
}
</script>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
<div align="center" >
<jsp:include page="head.jsp" flush="true" />
<jsp:include page="exam_title.jsp" flush="true" /><td width="736" bgcolor="#FFFFFF" height="22"><p align="center"><font face="楷体_GB2312" size="5" color="#000000"><strong>新参保查询结果</strong></font></p></td>
<form name="thisform" method="post" action="exam_new.jsp" >
<table>
<tr ><td width="80" height="26" align="left"><font face="楷体_GB2312" size="3" color="#000000"><B>单位编号</B></font></td>
<td width="18%" height="26" align="left">
<input name="unname" type="text" length="8" value="<%=str%>" onkeydown="keydown1();">
</td>
<td width="538" height="26" align="left">
<input type="button" value="查询" onClick="YearNull1();" id="SubData" name="SubData">
<input type="button" value="重添" onClick="YearNull();" name="button2">
</td>
</tr>
</table><%
//利用For循环配合PageSize属性输出一页中的记录
System.out.println("===========>1");
if(RowCount > 0)
{%>
<td width="736" bgcolor="#DFDFDF" height="22"><p align="center"><font face="楷体_GB2312" size="4" color="#000000"><strong>职工待审查询第<% out.print(ShowPage); %>页, 共<% out.print(PageCount); %>页</strong></font></p></td>
<%
System.out.println("===========>2");
for(int i = 1; i <= PageSize; i++)
{
System.out.println("===========>3");
%>
<table width="100%" border="1" class="font10" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF" bordercolor="#999999">
<input type="button" value="不同意" name="Refuse" onclick=ShowDialog() > </td>
</TR>
</table><%
System.out.println("===========>4-1");
//下面的if判断语句用于防止输出最后一页记录时,
//将记录指标移至最后一笔记录之后
if(!rs.next()) //判断是否到达最后一笔记录
break; //跳出for循环
}
System.out.println("===========>4");
%><TABLE>
<TR valign=baseline align=center>
<%
//判断目前所在分页是否为第一页,
//不是则显示到第一页与上一页的超链接
if(ShowPage != 1)
{
//下面建立的各超链接将链接至自己,
//并将欲显示的分页以ToPage参数传递给自己
%>
<TD Width=150>
<A Href="Javascript:PageFirst();">首页</A>
</TD>
<TD Width=150>
<A Href="Javascript:PageUp();">上一页</A>
</TD>
<%
}
//判断目前所在分页是否为最后一页,
//不是则显示到最后一页与下一页的超链接
if(ShowPage != PageCount)
{
//下面建立的各超链接将链接至自己,
//并将欲显示的分页以ToPage参数传递自己
%>
<TD Width=150>
<A Href="Javascript:PageDown();">下一页</A>
</TD>
<TD Width=150>
<A Href="Javascript:PageLast();">末页</A>
</TD>
<%
rs.close();
db_Exam.closeDB();
System.out.println("===========>5");
}
%><TD>
<FORM action=exam_new.jsp method=POST>
到
<INPUT type="text" name=ToPage style="HEIGHT: 25px; WIDTH: 40px"
value=<%= ShowPage%> onkeydown="keydown()"> 页
</FORM></TD></TR>
</TABLE>
</form>
<%}else {%>
<table width="100%" border="1" class="font10" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF" bordercolor="#999999">
<tr ><td width="300" height="26" align="left"><font face="楷体_GB2312" color="red" size="3" color="#000000"><B>没有您查询的记录</B></font></td>
</table>
<BR><% }%></div>
<jsp:include page="foot.jsp" flush="true" />
</body>
</html>
<%}%>