一种新的编程思路(下):附 自动分页 2-2 ntPageShow.jsp
2002-07-15 10:06
567 查看
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
)&&d.all) x=d.all
; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i]
;
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>
<% } %>
--------------------------------------------------------------------------------------
<% 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
)&&d.all) x=d.all
; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i]
;
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>
<% } %>
相关文章推荐
- 一种新的编程思路(下):附 自动分页2-1 ntPage.jsp
- 推荐用 Flash做一般文字为主的页面
- [教程]JScript中的变量引用规则(补充,函数用法说明)
- [教程]JScript中的变量引用规则(一)
- 汉字转化为拼音(jsp版)
- Lostinet作品:JScriptSoapClientv0.20Beta简单地异步调用你的WebService
- 如何在javascript中传值
- Lostinet作品:JScriptSoapClientv0.10Beta为你轻松调用WebService
- 简单的脚本帮你编排JScript程序中的缩进
- 得到 words.js?hello,world! 参数的处理方法
- 玩透弹出窗口
- 在WEB项目中多维下拉菜单的实现技巧和方法
- 用JScript实现VB.Net,C#的[委托Delegate]:
- 自己做二级域名的DNS
- 利用JScript/CSS 编程技术模拟实现TABView控件
- 在Web界面下数形目录显示程序(版本1.0)
- 利用JavaScript和正则表达式进行丰富的日期判断(给其它项目组的代码,有比较好的编程风格和注释)
- perl文件上传程序,支持多文件!
- javascript/Jscript实现父子窗体的互相引用问题(Powered By ZosaTapo)
- 对JSP Model 2工作流程的一些体会