list.jsp
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<%@ page import="com.tianbo.util.dao.Page" %><%--
Created by IntelliJ IDEA.
User: 烽
Date: 2015/7/11
Time: 19:47
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>Msg</title>
<script src="/js/common/jquery.js" type="text/javascript"></script>
<script src="/js/common/ajax.js" type="text/javascript"></script>
</head>
<body>
<h1>Msg</h1>
<table>
<tr>
<th>序号</th>
<%--<td>${msg.fid}</td>--%>
<th>消息类型</th>
<th>发送者</th>
<th>类型</th>
</tr>
<c:set var="page" value="${map.get('page')}"></c:set>
<c:forEach items="${map.get('list')}" var="msg" varStatus="num">
<tr>
<td>${(num.index+1)+(page.getCurrent()-1)*page.getLength()}</td>
<%--<td>${msg.fid}</td>--%>
<td>${msg.messtype}</td>
<td>${msg.sndr}</td>
<td>${msg.type}</td>
</tr>
</c:forEach>
</table>
共${page.getTotal()}页,共${page.getCount()}条数据,当前第${page.getCurrent()}页,每页${page.getLength()}条
<div>
<c:set var="endPage" value="false" />
<c:forEach begin="0" step="1" end="${page.getTotal()-1}" var="everyPage">
<c:choose>
<c:when test="${everyPage+1 >10}">
<c:if test="${endPage=='false'}">
<label>......</label>
<c:set var="endPage" value="true" />
</c:if>
</c:when>
<c:otherwise>
<a href="/msg/list?page.begin=${everyPage*page.length}">${everyPage+1}</a>
</c:otherwise>
</c:choose>
</c:forEach>
<a href="/msg/list?page.begin=${(page.getTotal()-1)*page.length}">${page.getTotal()}</a>
转到第<input type="text" name="turnPage" id="turn2page">页 <button onclick="turn2page();">确定</button>
</div>
<script type="text/javascript">
function turn2page(){
var pageVal = $("#turn2page").val();
var pageBegin = (pageVal-1)*${page.length};
var url="/msg/list";
var para = {"page.begin":+pageBegin};
handleAjax(url,para,"post","","").done(function(resp){
alert(resp);
}).fail(function(err){
alert(err);
});
}
</script>
</body>
</html>