一种新的编程思路(下):附 自动分页 2-2 ntPageShow.jsp

ntPageShow.jsp

--------------------------------------------------------------------------------------

<% if( !onlyOnePage )
   { 
     String srq = "";
     Enumeration erq = request.getParameterNames();
     String sPageSize = "";
     while (erq.hasMoreElements()) {
       String s = (String)erq.nextElement();
       //
       if( s.equals("page") ) continue;
       else if( s.equals("nouse") ) continue;
       else if( s.equals("imageField_jump.x") ) continue;
       else if( s.equals("imageField_jump.y") ) continue;
       else if( s.equals("pagesize") ){
         sPageSize = "&pagesize=" + request.getParameter(s) ;
         continue;
       }
       else if( s.equals("pagesize_post") ){
         sPageSize = "&pagesize=" + request.getParameter(s) ;
         continue;
       }
       //
       if( s==null || s.equals("") ) s = "";
       s = URLEncoder.encode( s );
       String v = (String)(request.getParameter(s));
       if( v==null || v.equals("") ) v = "";
       v = URLEncoder.encode( v );
       srq = srq + "&"+ s +"="+v;
     }
     srq = srq + sPageSize ;
%>

<script language="JavaScript">
<!--
function MM_swapImgRestore() { file://v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { file://v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { file://v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { file://v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
file://-->
</script>

<style type="text/css">
<!--
.tb {  height: 18px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; border: 1px #FFFFFF solid; clip:     rect(   ); background-color: #7CE6E9}
-->
</style>

<script>
MM_preloadImages('images/page_first_over.gif','images/page_prior_over.gif','images/page_jump_over.gif','images/page_next_over.gif','images/page_last_over.gif');
</script>

<div align="center">

<form name="formPage" method="post" action="<%= request.getRequestURI() %>?nouse=1<%=srq%>">
<table width="98%" border="0" cellspacing="0" cellpadding="0" >
    <tr>
      <td width="87" valign="top" height="28">
      <% if( curPage > 1 ){ %>
        <a href="<%= request.getRequestURI() %>?page=1<%=srq%>"
        onMouseOut="MM_swapImgRestore()"
        onMouseOver="MM_swapImage('home','','images/page_first_over.gif',1)">
      <% } %>
        <img name="home" border="0"
        src="images/page_first.gif" width="87" height="28">
      <% if( curPage > 1 ){ %>  </a> <% } %>
      </td>
      <td background="images/page_bg.gif" valign="top" height="28">
        <div align="center">
      <% if( curPage > 1 ){ %>
        <a href="<%= request.getRequestURI() %>?page=<%= curPage -1 %><%=srq%>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('back','','images/page_prior_over.gif',1)">
      <% } %>
        <img name="back" border="0" src="images/page_prior.gif" width="57" height="28">
      <% if( curPage > 1 ){ %>  </a> <% } %>
        </div>
      </td>
      <td background="images/page_bg.gif" height="28">
        <div align="center"><font size="2">第 <%= curPage%>/<%= pageCount %> 页</font></div>
      </td>
      <td background="images/page_bg.gif" height="28" valign="top">
          <div align="right">
          <%--a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('tz','','images/page_jump_over.gif',1)"--%>
            <input type="image" border="0" name="imageField_jump" src="images/page_jump.gif" width="29" height="28">
            <%--/a--%>
          </div>
      </td>
      <td background="images/page_bg.gif" valign="top" height="28">
        <div align="left">
        <img src="images/page_blue.gif" width="1" height="2"><br>
        <input type="text" name="page" size="2" value="<%= curPage %>" class="tb"><img src="images/rows.gif" width="18" height="18"><input type="text" name="pagesize_post" size="2" value="<%= PAGESIZE %>" class="tb">
        </div>
      </td>
      <td background="images/page_bg.gif" valign="top" height="28">
        <div align="center">
        <% if( curPage < pageCount ){ %>
        <a href="<%= request.getRequestURI() %>?page=<%= curPage + 1 %><%=srq%>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('next','','images/page_next_over.gif',1)">
        <% } %>
        <img name="next" border="0" src="images/page_next.gif" width="53" height="28">
        <% if( curPage < pageCount ){ %> </a> <% } %>
        </div>
      </td>
      <td width="87" valign="top">
      <% if( curPage < pageCount ){ %>
      <a href="<%= request.getRequestURI() %>?page=<%= pageCount %><%=srq%>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('end','','images/page_last_over.gif',1)">
      <% } %>
      <img name="end" border="0" src="images/page_last.gif" width="87" height="28">
      <% if( curPage < pageCount ){ %> </a> <% } %>
      </td>
    </tr>
</table>
</form>
</div>
<% } %>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值