<%@ page language="java" %>
<%@ page import="java.sql.*"%>
<%@ page contentType="text/html; charset=GBK" %>
<jsp:useBean id="dbo" scope="page" class="pub.dbBean"/>
<jsp:useBean id="strc" scope="page" class="pub.StringChange"/>
<jsp:useBean id="check" scope="page" class="checkUser.checkUserBean"/>
<%
int i=-1;
String sql="";
String sDASql="";
String isSearch="";
String fieldName="";
String fieldOp="";
String fieldValue="";
String fieldNewOp ="";
String sSearch="";
String searchagain="";//Set fso = CreateObject("Scripting.FileSystemObject")
isSearch=request.getParameter("action");
if (isSearch!=null && isSearch.equals("adv_search"))
    {
fieldName=request.getParameter("fieldName");
fieldOp=request.getParameter("fieldOp");
fieldOp=fieldOp.trim();
fieldValue=request.getParameter("fieldValue");
                fieldValue=fieldValue.trim();
if (fieldValue!="")
   {
if (fieldOp.equals("like") || fieldOp.equals("not like"))
    sSearch=fieldName+" "+fieldOp+"  '%"+fieldValue+"%' ESCAPE '!'  "+fieldNewOp+" ";
else
    sSearch=fieldName+" "+fieldOp+" '"+fieldValue+"' "+fieldNewOp+" ";
           } 
             
if (sSearch.trim()=="")
sSearch="1=1";
searchagain=request.getParameter("searchagain");
if (searchagain.equals("againyes") && session.getAttribute("old_where_f")!="")
        {
sSearch=session.getAttribute("old_where_f")+" and "+sSearch;     
                }
session.putValue("old_where_f",sSearch);
 //     sql = dbfun.InsertWhereToSQL(session("sDASql"),sSearch&"") 
session.putValue("olddasql",sql);
     }
else
    {
    if ((session.getAttribute("olddasql")!=null)  && request.getParameter("page")!=null )
        sql=(String)session.getAttribute("olddasql");
    else
        {
sql="Select * From foa_DA where 1=1";
session.putValue("sDASql",sql);
        session.putValue("olddasql","");
session.putValue("old_where_f","");
}
     } //sql=sql.replace("[","![");
//sql=sql.replace("]","!]");
out.print(sql); ResultSet rs=dbo.executeQuery(sql);if(rs!=null)
{
%>
<HTML><HEAD><TITLE>航星博弈-档案管理</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<BODY bgcolor="#ffffff"  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  <div align="center">
  <center>
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr><td width="100%"><script language="JavaScript">
window.focus();
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
 
<%@ include file="top.jsp" %><table width="770" border="0" cellspacing="0" cellpadding="4" align="center" bgcolor="#ffffff">
  <tr valign="top"> 
    <td width="65"><img src="left_menu.png" width="50" height="341" usemap="#Map" border="0"><map name="Map"><area shape="poly" coords="1,146,1,340,47,301,47,180,33,166" href="s_document.jsp"><area shape="poly" coords="1,1,1,145,33,165,47,150,47,34" href="s_file.jsp"></map> 
    </td>
    <td width="932"> 
      <table id=titleTab cellspacing=0 cellpadding=0 width="100%" border=0 align="center">
        <form name=form1  action="s_document.jsp" method=post>
          <tr> 
            <td width="658" > 
              <table width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
                <tr> 
                  <td width="121"><img height=30 src="images/title.gif" width=109></td>
                  <td width="528"> 
                    <table class=classTab id=menuTab height=25 cellspacing=0   bordercolordark=#ffffff cellpadding=0 bgcolor=#e5e5e5 
      bordercolorlight=#000000 border=1 align="center" width="100%">
                      <tbody> 
                      <tr> 
                        <td valign=middle align=center nowrap width="15%"> 
                          <select name="fieldName">
                            <option value="f_tm" selected>题名</option>
                            <option value="f_zrz">归档单位</option>
                            <option value="f_nd">年度</option>
    <option value="f_GJH">档号&nbsp&nbsp</option>
                          </select>
                        </td>
                        <td align=middle width="15%"> 
                          <select name="fieldOp">
                            <option value='like'>包含</option>
                            <option value='='>等于</option>
                            <option value='<>'>不等于</option>
                            <option value='not like'>不包含</option>
                          </select>
                        </td>
                        <td align=middle width="25%"> 
                          <input type='text' name="fieldValue" size=13>
                          <input name="action" type="hidden" value="adv_search">
                        </td>
                        <td align=middle width="11%"> 
                          <input type=submit value="查询" name="submit">
                        </td>
                        <td noWrap align=middle width="17%"> <label for=inResult> 
                          <input type="radio" name="searchagain" value="againno"  checked>
                          <label for=inResult>重新查询</label> </label></td>
                        <td noWrap align=middle width="17%"> 
                          <input type="radio" name="searchagain" value="againyes">
                          <label for=inResult>在结果中查询</label> </td>
                      </tr>
                      </tbody> 
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </form>
      </table>
      <table class=classTab cellspacing=0 cellpadding=0 border="0" width="100%">  
      <tr bgcolor="#FFCC66" height="35" width="100%">
      <td>
      <input type="radio" name="da" value="da"  checked>
      <label for=inResult><font face="楷体_GB2312"><b>档案</b></font></label> </label>
      <input type="radio" name="da" value="flml" onclick="location='s_flml.jsp'">
      <label for=inResult><font face="楷体_GB2312"><b>新文书规则</b></font></label>
      </td>
      </tr>
      </table>
      <table class=classTab cellspacing=0 cellpadding=0 border=0 width="100%"> 
        <tr> 
          <td noWrap height=25 width="1" background="images/line_grey.gif" bgcolor="#FFCC66"></td>
          <td width="3" bgcolor="#FFCC66"></td>
          <td width="3" bgcolor="#FFCC66"></td>
          <td noWrap height=25 width="100" bgcolor="#FFCC66" align="center"><font size=5 face="楷体_GB2312","宋体"><b>档&nbsp&nbsp号</b></font></td>
          <td noWrap height=25 width="1" background="images/line_grey.gif" bgcolor="#FFCC66"></td>
          <td noWrap height=25 width="130" bgcolor="#FFCC66" align="center"><font size=5 face="楷体_GB2312","宋体"><b>归档单位</b></font></td>
          <td noWrap height=25 width="1" background="images/line_grey.gif" bgcolor="#FFCC66"></td>
          <td width="5" bgcolor="#FFCC66"></td>
  <td width="467" bgcolor="#FFCC66" align="center"><font size=5 face="楷体_GB2312","宋体"><b>题&nbsp&nbsp&nbsp&nbsp&nbsp名</b></font></td>
          <td noWrap height=25 width="1" background="images/line_grey.gif" bgcolor="#FFCC66"></td>
          <td noWrap height=25 width="70" bgcolor="#FFCC66" align="center"><font size=5 face="楷体_GB2312","宋体"><b>年&nbsp度</b></font></td> 
          <td noWrap height=25 width="1" background="images/line_grey.gif" bgcolor="#FFCC66"></td>
        </tr>

解决方案 »

  1.   

    续上:        <%
    //--start分页参数设置
    int intPageSize=15; //一页显示的记录数
    int intRowCount; //记录总数
    int intPageCount; //总页数
    int intPage; //待显示页码
    String strPage;
    int k=0;
    //取得待显示页码
    strPage = request.getParameter("page");
    if(strPage==null)
    {//表明在QueryString中没有page这一个参数,此时显示第一页数据
    intPage = 1;
    }else{//将字符串转换成整型
    intPage =Integer.parseInt(strPage);
    if(intPage<1) intPage = 1;
         }
    //获取记录总数
    rs.last();
    intRowCount = rs.getRow();
    //记算总页数
    intPageCount = (intRowCount+intPageSize-1) / intPageSize;
    //调整待显示的页码
    if(intPage>intPageCount) intPage = intPageCount;%> <%
    if(intPageCount>0){
    //将记录指针定位到待显示页的第一条记录上
    rs.absolute((intPage-1) * intPageSize + 1);
    //显示数据
    i = 0;
    while(i<intPageSize && !rs.isAfterLast()){
    %> 
            <tr> 
              <td noWrap height=40 width="1" background="line_grey.gif" valign="center" bgcolor="#<%
    if (k==1) 
     out.print("FAEBD7");
    else
     out.print("f5f5f5");
             
    %>"></td>
              <td width="3" bgcolor="#<%
    if (k==1) 
     out.print("FAEBD7");
    else
     out.print("f5f5f5");
             
    %>"></td>
              <td width="3" bgcolor="#<%
    if (k==1)  
     out.print("FAEBD7");
    else
     out.print("f5f5f5");
             
    %>"></td>
              <td noWrap height=40 width="100" valign="center" bgcolor="#<%
    if (k==1) 
     out.print("FAEBD7");
    else
     out.print("f5f5f5");
             
    %>"><%=rs.getString("f_GJH")%></td>
              <td noWrap height=40 width="1" valign="center" background="line_grey.gif"></td>
              <td noWrap height=40 width="130" valign="center" bgcolor="#<%
    if (k==1) 
     out.print("FAEBD7");
    else
     out.print("f5f5f5");
             
    %>"><%=rs.getString("f_ZRZ")%></td>
              <td  width="1" background="line_grey.gif" valign="center" bgcolor="#<%
    if (k==1) 
     out.print("FAEBD7");
    else
     out.print("f5f5f5");
             
    %>"></td>
              <td width="5" bgcolor="#<%
    if (k==1) 
     out.print("FAEBD7");
    else
     out.print("f5f5f5");
             
    %>"></td>
              <td valign="center" height=40 width="467" valign="center" bgcolor="#<%
    if (k==1) 
     out.print("FAEBD7");
    else
     out.print("f5f5f5");
             
    %>"><a href="dafiles.asp?id=<%=rs.getString("ID")%>"  onClick="MM_openBrWindow(this.href,'detail','scrollbars=yes')" target="detail"> 
                <%=rs.getString("f_TM")%></a></td>
              <td noWrap height=40 width="1" valign="center" background="line_grey.gif"></td>
              <td noWrap height=40 width="70" align="center" valign="center" bgcolor="#<%
    if (k==1) 
     out.print("FAEBD7");
    else
     out.print("f5f5f5");%>"><%=rs.getString("f_ND")%></td>     
    <td noWrap height=25 width="1" background="line_grey.gif" bgcolor="#FFCC66"></td>        
            </tr>
            <%
    if (k==1)
    k=k-1;
    else
    k=k+1;
    rs.next();
    i++;
    }
    }
    }  //end if(rs!=null)
    %> 
     
          </table>
          <table width="100%" align="center" cellspacing="0" border="0" cellpadding="0">
            <tr bgcolor=#FFCC66> 
              <td colspan="7" width="100%"> 
                <table width="613" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFCF63">
                  <tr align="CENTER" valign="BOTTOM"> 
                    <td class="tr_title" width="202" bgcolor="#FFCC66"></td>
                    <td class="tr_title" width="85"><%if (intPageCount>1){%><a href="s_document.jsp?page=1">首页</a>
                    <%}else{%>首页<%}%></td>
                    <td class="tr_title" width="135"> <%if (intPage>1) {%> <a href="s_document.jsp?page=<%=intPage-1%>">上一页</a> 
                      <%} else {%> 上一页 <%}%> </td>
                    <td class="tr_title" width="86"> <% if(intPage<intPageCount) {%> 
                      <a href="s_document.jsp?page=<%=intPage+1%>">下一页</a> <%}else{%> 下一页 
                      <%}%> </td>
                    <td class="tr_title" width="105"><%if (intPageCount>1){%><a href="s_document.jsp?page=<%=intPageCount%>&amp;">尾页</a>
                    <%}else{%>尾页<%}%></td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    <%@ include file="end.jsp" %>
    </td>
        </tr>
      </table>
      </center>
    </div>
    <%rs.close();%>
    </body>
    </html>
    我定义了呀,是不是分页有问题呀?
      

  2.   

    大哥,你得intPageCount、intPage变量定义都是在
    if(rs!=null)
    {
    }  //end if(rs!=null)
    这个if里面的,它只是个局域变量,你在这个if外边使用它,当然是没有定义了!!!