You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

97 lines
3.5 KiB

<!DOCTYPE html>
<html lang="en">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <!--输出,条件,迭代标签库-->
<%@ page pageEncoding="utf-8" %>
<head>
<c:import url="head.jsp"/>
<script>
$(function () {
$("#pageButton button").click(function () {
$("[name=firstResult]").val($(this).val());
$('#pageForm').submit();
});
});
</script>
</head>
<body>
<c:choose>
<c:when test="${datas.type=='success'}">
<c:import url="form.jsp"/>
<table class="table">
<thead>
<tr>
<th scope="col">cid</th>
<th scope="col">aid</th>
<th scope="col">title</th>
<th scope="col">subtitle</th>
<th scope="col">author</th>
</tr>
</thead>
<tbody>
<c:forEach items="${datas.datas}" var="data">
<tr>
<td>${data.cid}</td>
<td>${data.aid}</td>
<td>${data.title}</td>
<td>${data.subtitle}</td>
<td>${data.author}</td>
</tr>
</c:forEach>
</tbody>
</table>
<form:form id="pageForm" action="/data/table">
<input type="hidden" name="firstResult" value="0"/>
<input type="hidden" name="maxResults" value="${datas.pageSize}"/>
<div class="row">
<div class="col-sm-6">
<p class="text-justify font-weight-bold">
Showing ${(datas.currentPage-1)*datas.pageSize+1} to ${datas.currentPage*datas.pageSize}
of ${datas.count} entries
</p>
</div>
<div class="col-sm-6">
<div id="pageButton" class="btn-toolbar justify-content-end" role="toolbar"
aria-label="Toolbar with button groups">
<div class="btn-group mr-2" role="group">
<button value="0" type="button" class="btn btn-secondary">首页</button>
<button value="${datas.currentPage-2}" type="button" class="btn btn-secondary"
<c:if test="${datas.currentPage-2==-1}">disabled</c:if>>上一页
</button>
<button value="${datas.currentPage}" type="button" class="btn btn-secondary">下一页</button>
<button value="${datas.pages}" type="button" class="btn btn-secondary">尾页</button>
</div>
<div class="btn-group mr-2" role="group">
<c:forEach begin="${datas.currentPage+1}"
end="${datas.currentPage+9}" var="i">
<c:if test="${i<=datas.pages}">
<button value="${i}" type="button" class="btn btn-secondary">${i}</button>
</c:if>
</c:forEach>
</div>
</div>
</div>
</div>
</form:form>
</c:when>
<c:otherwise>
<div class="alert alert-danger text-center" role="alert">
${datas.errorMsg}
</div>
</c:otherwise>
</c:choose>
</body>
</html>