plugins
来源:互联网 发布:chart.js官方文档 编辑:程序博客网 时间:2024/04/29 03:50
http://hi.baidu.com/rxt_gogle/blog/item/13c073159e498ad2a7ef3fb9.html
原创分页“插件”——JSTL版
最近,自己做一个分页的“插件”。说他是插件,是因为,自己认为比较用通用性吧。
要不把这样的分页程序写在JSP界面上会觉得很乱。而用的时候,直接 <jsp:include flush="true" page=""/>就可以了。
好,那这次做的是JSTL版本的。
插件如下:
<c:if test="${page==1}">
<button disabled="disabled">首页</button>
<button disabled="disabled">上一页</button>
</c:if>
<!--关键字为空 -->
<c:if test="${empty keyWord}">
<c:if test="${page>1}">
<button onclick="myForword(1,'')">首页</button>
<button onclick="myForword(${page-1 },'')">上一页</button>
</c:if>
<c:if test="${page==totalPage}">
<button disabled="disabled">下一页</button>
<button disabled="disabled">尾页</button>
</c:if>
<c:if test="${page<totalPage}">
<button onclick="myForword(${page+1 },'')">下一页</button>
<button onclick="myForword(${totalPage },'')">尾页</button>
</c:if>
<form action="EmpServlet" method="post" name="form2">
跳转到
<select name="page" onchange="document.form2.submit()">
<c:forEach var="i" begin="1" end="${totalPage}" step="1">
<option value=${i } <c:if test="${i==page }">selected</c:if> >${i }</option>
</c:forEach>
</select>
页
</form>
</c:if>
<!--关键字不为空 -->
<c:if test="${not empty keyWord}">
<c:if test="${page>1}">
<button onclick="myForword(1,'${keyWord }')">首页</button>
<button onclick="myForword(${page-1 },'${keyWord }')">上一页</button>
</c:if>
<c:if test="${page==likePage}">
<button disabled="disabled">下一页</button>
<button disabled="disabled">尾页</button>
</c:if>
<c:if test="${page<likePage}">
<button onclick="myForword(${page+1 },'${keyWord }')">下一页</button>
<button onclick="myForword(${likePage },'${keyWord }')">尾页</button>
</c:if>
<form action="EmpServlet" method="post" name="form3">
<input type="hidden" name="keyWord" value="${keyWord }"> <!-- 关键 -->
跳转到
<select name="page" onchange="document.form3.submit()">
<c:forEach var="i" begin="1" end="${likePage}" step="1">
<option value=${i } <c:if test="${i==page }">selected</c:if> >${i }</option>
</c:forEach>
</select>
页
</form>
</c:if>
<!--关键字为空 -->
<c:if test="${empty keyWord}">
<h2>共<font color="red">${totalCount }</font>条记录</h2>
<h2>第<font color="red">${page }</font>页 共<font color="red">${totalPage }</font>页</h2>
</c:if>
<!--关键字不为空 -->
<c:if test="${not empty keyWord}">
<h2>共<font color="red">${likeCount }</font>条记录</h2>
<h2>第<font color="red">${page }</font>页 共<font color="red">${likePage }</font>页</h2>
</c:if>
执行跳转的JavaScript代码如下:
//跳转
function myForword(page,keyWord)
{
location.href="EmpServlet?page="+page+"&keyWord="+keyWord;
}
介绍完毕,前台使用,仅供参考。
- plugins
- Plugins
- Eclipse Plugins
- Eclipse Plugins
- Eclipse Plugins
- Winamp Plugins
- Winamp Plugins
- Eclipse Plugins
- eclipse plugins
- symfony plugins
- ROR plugins
- MCE PLUGINS
- Plugins - auto_complete
- JQuery Plugins
- Fms plugins
- Eclipse Plugins
- Eclipse PlugIns
- vim plugins
- Win32程序开发流程
- 查看当前数据库的性能数据
- 基于TCP的网络游戏黑白棋系列(二):数据传输
- iPhone – Wrap Text in UILabel
- 基于TCP的网络游戏黑白棋系列(三):游戏大厅
- plugins
- 基于TCP的网络游戏黑白棋系列(四):游戏棋盘
- 更改SQL Server sa密码、默认端口 以及ADO连接字符串指定端口号
- JMS-ActiveMQ入门
- JOJ 2727: GRE(混合欧拉路)
- Notepad++源码剖析(五)
- 有线电视的波段和频道
- JSTL 标签 fn 函数
- 解决dedeEims搜索提示“搜索小于2个字节”方案