<%
//以下代码实现分页
int recCount = 0; //当前记录数
int rowCount; //行总数
int pageCount; //页总数
int displayRecs = page_displayrecs; //每页显示的行数
int intPage=1; //当前页码
int intPage1; //最后一页
if(request.getParameter("start")==null)
{
intPage=1;
intPage1=1;
}
else
{
sql=request.getParameter("sql");
intPage=Integer.parseInt((String)request.getParameter("start"));
intPage1=intPage;
}
%>
<% //out.print(sql);
String ss3="";
String ss4="";
String ss5="";
String ygxdm="";//原关系代码,
String gxdm;//截取后可查询到所信息
String qypcs;//所
String lsgxdm;
//调用javabean.MDsjkczBean计算分页,查询显示数据
//out.println("sql:"+sql);
//if(true)return;
LinkedList ll=MDsjkczBean.MDllsnqcry(sql,displayRecs,intPage);
//利用LinkedList类存储所查询到的结果集,其中第一项为所查经果的总行数,第二项为所查结果的总页数
rowCount=Integer.parseInt((String)ll.get(0));
pageCount=Integer.parseInt((String)ll.get(1));
if(rowCount==0 || pageCount==0)
{
response.sendRedirect("TS_nors.jsp");
return;
}
String[] ss=null;
int size=ll.size();
if(ll.size()>2){ //if<F>
%>
<table width="<%=tablewidth%>"align="center" cellpadding="0" cellspacing="0" class="tablebig">
<tr>
<td align="center">
<table width="101%" border="0" cellpadding="0" cellspacing="0">
<tr class="notprint">
<td align="center" background="image/m_writer.gif"><table width="400" border="0" align="left" cellpadding="0" cellspacing="0">
<tr background="image/m_writer.gif">
<td width="50" align="center"><img src="image/m_writel.gif" width="50" height="25"></td>
<td width="664" align="left" background="image/m_writer.gif"><font class="title"></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" align="left" cellpadding="0" cellspacing="1">
<tr>
<th width="4%" align="center">序号</th>
<th width="7%" align="center">姓名</th>
<th width="2%" align="center">性别</th>
<th width="10%" align="center">出生日期</th>
<th width="16%" align="center">住址</th>
<th width="8%" align="center">号</th>
<th width="12%" align="center">时间</th>
<th width="10%" align="center">所</th>
<th width="10%" align="center">号</th>
<th width="10%" align="center">情况</th>
<th width="7%" align="center">户</th>
<input type="hidden" name="h_dyzc" value="@序号@姓名@性别@出生日期@住址@号@时间@所@号@情况@户">
</tr>
<tr class="tr3">
<td height="1" colspan="11"></td>
</tr>
<%
//循环显示数据
for(int j=2;j<size;j++)
{//for<1>
ss=(String[])ll.get(j);
if(ss[3]!=null){ss3=(MDzdBean.MDzdzh(application.getAttribute("A_JLX"),ss[3])).trim();}else{ss3="";}//将换为汉字
if(ss[4]!=null){ss4=ss[4].trim();}else{ss4="";}
if(ss[5]!=null){ss5=ss[5].trim();}else{ss5="";}
if(ss[15]!=null){ygxdm=ss[15].trim();}else{ygxdm="";}
if(ss[16]!=null){lsgxdm=ss[16].trim();}else{lsgxdm="";}
lsgxdm=lsgxdm.substring(0,6);
gxdm=ygxdm.substring(0,4)+ygxdm.substring(6,11);
qypcs=MDzdBean.MDzdzh(application.getAttribute("A_PCS"),gxdm);
String ys="";
if(j%2==0)ys="tr1";else ys="tr2";
%>
<tr class=<%=ys%> onMouseOver="this.className='trfocus'" onMouseOut="this.className='<%=ys%>'">
<td align="center"><%=(displayRecs*(intPage - 1) + (j-1))%></td>
<td align="center" style="font-family:方正宋体-信息" nowrap><div align="left"><a href="javascript:showxxxx('MDxxxx.jsp?PID=<%=ss[9]%>','信息')" title="信息"><%=ss[0]==null||ss[0].length()==0?"":ss[0]%></a></div></td>
<%
String str_xb="";
if(ss[1].equals("1"))
str_xb="男";
else
str_xb = "女";
%>
<td align="center" nowrap><%=ss[1]==null||ss[1].length()==0?"":str_xb%></td>
<td align="center" nowrap><div align="center"><%=ss[2]==null||ss[2].length()==0?"":MDrqBean.MDrqzh8(ss[2])%></div></td>
<td align="center" nowrap><div align="left"><a href="javascript:showxxxx('MDmlpxx.jsp?PID=<%=ss[12]%>','信息')" title="信息"><%=(ss3+ss4+ss5)%></a></div></td>
<td align="center" nowrap><a href="javascript:showxxxx('MDxshcyxx.jsp?PID=<%=ss[6]%>','信息')" title="信息" ><%=ss[6]==null?"":ss[6]%></a></td>
<td align="left" nowrap><div align="center"><%=ss[7]==null||ss[7].length()==0?"":MDrqBean.MDrqzh14(ss[7])%></div></td>
<td align="left" nowrap><div align="center"><a href="javascript:showxxxx('MDdyqyz_llqc.jsp?PID=<%=ss[13]%>&PIDD=1','迁')" title="打印" ><%=qypcs%></a></div></td>
<td align="left" nowrap><a href="javascript:showxxxx('MAzzbdxxjxcx_xxxx.jsp?PID=<%=ss[9]%>&slsj=<%=ss[7]%>&xzz_dzwym=<%=ss[14]%>','息')" title="地"><%if(ss[10]!=null && !ss[10].equals("")){out.print("全户迁出");}else{if(ss[11].equals("02")){out.print("个");}else{out.print("个");}}%></a>
<%
String hz = "";
LinkedList ll_hz=MDsjkczBean.MDcx("select xm from rkjbxx where hh='"+ss[6]+"' and (yhzgx='02' or yhzgx='03') and (jlzt='0' or jlzt='2' )");
// out.println("<p>"+"select xm from rkjbxx where hh='"+ss[6]+"' and (jtgx='02' or jtgx='03') and (jlzt='0' or jlzt='2' )"+"<p>");
if(ll_hz!=null&&ll_hz.size()>0){
String temp_hz [] = (String [])ll_hz.get(0);
if(temp_hz!=null&&temp_hz.length>0&&temp_hz[0]!=null){
hz=temp_hz[0];
}
}
if(hz==null)hz="";
%>
<%
if(ss[1].equals("1"))
ss[1]="男";
else
ss[1] = "女";
%>
<td align="center"><%=ss[8]==null||ss[8].length()==0?"":ss[8]%></td>
<td align="center"><%=hz%></td>
<input type="hidden" name="h_dyzc" value="@<%=(displayRecs*(intPage - 1) + (j-1))%>@<%=ss[0]==null||ss[0].length()==0?"":ss[0]%>@<%=ss[1]==null||ss[1].length()==0?"":ss[1]%>@<%=ss[2]==null||ss[2].length()==0?"":MDrqBean.MDrqzh8(ss[2])%>@<%=(ss3+ss4+ss5)%>@<%=ss[6]==null?"":ss[6]%>@<%=ss[7]==null||ss[7].length()==0?"":MDrqBean.MDrqzh14(ss[7])%>@<%=ss[8]==null?"":ss[8]%>@<%if(ss[10]!=null && !ss[10].equals("")){out.print("全");}else{if(ss[11].equals("02")){out.print("个)");}else{out.print("个");}}%>@<%=hz%>"></td>
</tr>
<%
}//end for<1>
}//end if<F>
%>
一个大体的结构吧,方法比较老,但是是我现在项目的真实一段,看看吧,希望有帮助。