<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<script type="text/javascript">
function check(){
return confirm("是否删除");
}
function fanye(key){
var currentPageIdexObj = document.getElementById("currentPageIndex");
switch (key){
case 1:
currentPageIdexObj.value =1;
break;
case 2:
//+currentPageIdexObj.value字符串变成整数类型
currentPageIdexObj.value= +currentPageIdexObj.value -1;
break;
case 3:
currentPageIdexObj.value= +currentPageIdexObj.value +1;
break;
case 4:
currentPageIdexObj.value= ${pagination.totalPages};
break;
}
document.forms[0].submit();
}
</script>
</head>
<body>
<%@ include file="nav.jsp"%>
<a href="toAddStudent.do">添加学生</a>
<h4>查找学生</h4>
<form action="listStudents.do" method="post">
<input type="hidden" id="currentPageIndex" name="currentPageIndex" value="${pagination.currentPageInde}"/>
姓名:<input type="text" name="likeName" value="${pagination.condition.likeName}"/>
性别:<select name="sex">
<option value="">请选择</option>
<option <c:if test="${pagination.condition.sex eq '男'}">selected="selected"</c:if> value="男">男</option>
<option <c:if test="${pagination.condition.sex eq '女'}">selected="selected"</c:if> value="女">女</option>
</select>
班级:<select name="gradeId">
<option value=""></option>
<c:forEach items= "${grades}" var="grade">
<option <c:if test="${pagination.condition.gradeId eq grade.id}">selected="selected"</c:if> value="${grade.id}">${grade.name}</option>
</c:forEach>
</select><br/>
出生日期大于:<input value="${pagination.condition.minBorn}" type="date" name="minBorn"/>
出生日期小于:<input value="${pagination.condition.maxBorn}" type="date" name="maxBorn"/><br/>
<input type="submit" value="提交"/>
</form>
<table >
<thead>
<tr>
<th>编号</th>
<th>名字</th>
<th>性别</th>
<th>出生日期</th>
<th>班级</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${pagination.result}" varStatus="rs" var="student">
<tr <c:if test="${rs.index%2 eq 0}">style="background-color: bisque" </c:if>>
<td>${student.id}</td>
<td>${student.name}</td>
<td>${student.sex}</td>
<td>${student.born}</td>
<td>${student.grade.name}</td>
<td><a href="deleteStudent.do?id=${student.id}" οnclick="return check()">删除</a> </td>
<td><a href="toUpdateStudent.do?id=${student.id}&¤tPageIndex=${pagination.currentPageInde}">修改</a> </td>
</tr>
</c:forEach>
</tbody>
</table>
共查询到${pagination.totalCount}条,
共分${pagination.totalPages}页
当前显示第${pagination.startNum}到${pagination.endNum}<br/>
<c:if test="${not pagination.firstPage}">
<%-- <a href="listStudents.do?currentPageIndex=1">首页</a>
<a href="listStudents.do?currentPageIndex=${pagination.currentPageInde-1}">上一页</a>--%>
<a href="javascript:fanye(1)">首页</a>
<a href="javascript:fanye(2)">上一页</a>
</c:if>
<c:if test="${not pagination.lastPage}">
<%--<a href="listStudents.do?currentPageIndex=${pagination.currentPageInde+1}">下一页</a>
<a href="listStudents.do?currentPageIndex=${pagination.totalPages}">末页</a>--%>
<a href="javascript:fanye(3)">下一页</a>
<a href="javascript:fanye(4)">末页</a>
</c:if>
</body>
</html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<script type="text/javascript">
function check(){
return confirm("是否删除");
}
function fanye(key){
var currentPageIdexObj = document.getElementById("currentPageIndex");
switch (key){
case 1:
currentPageIdexObj.value =1;
break;
case 2:
//+currentPageIdexObj.value字符串变成整数类型
currentPageIdexObj.value= +currentPageIdexObj.value -1;
break;
case 3:
currentPageIdexObj.value= +currentPageIdexObj.value +1;
break;
case 4:
currentPageIdexObj.value= ${pagination.totalPages};
break;
}
document.forms[0].submit();
}
</script>
</head>
<body>
<%@ include file="nav.jsp"%>
<a href="toAddStudent.do">添加学生</a>
<h4>查找学生</h4>
<form action="listStudents.do" method="post">
<input type="hidden" id="currentPageIndex" name="currentPageIndex" value="${pagination.currentPageInde}"/>
姓名:<input type="text" name="likeName" value="${pagination.condition.likeName}"/>
性别:<select name="sex">
<option value="">请选择</option>
<option <c:if test="${pagination.condition.sex eq '男'}">selected="selected"</c:if> value="男">男</option>
<option <c:if test="${pagination.condition.sex eq '女'}">selected="selected"</c:if> value="女">女</option>
</select>
班级:<select name="gradeId">
<option value=""></option>
<c:forEach items= "${grades}" var="grade">
<option <c:if test="${pagination.condition.gradeId eq grade.id}">selected="selected"</c:if> value="${grade.id}">${grade.name}</option>
</c:forEach>
</select><br/>
出生日期大于:<input value="${pagination.condition.minBorn}" type="date" name="minBorn"/>
出生日期小于:<input value="${pagination.condition.maxBorn}" type="date" name="maxBorn"/><br/>
<input type="submit" value="提交"/>
</form>
<table >
<thead>
<tr>
<th>编号</th>
<th>名字</th>
<th>性别</th>
<th>出生日期</th>
<th>班级</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<c:forEach items="${pagination.result}" varStatus="rs" var="student">
<tr <c:if test="${rs.index%2 eq 0}">style="background-color: bisque" </c:if>>
<td>${student.id}</td>
<td>${student.name}</td>
<td>${student.sex}</td>
<td>${student.born}</td>
<td>${student.grade.name}</td>
<td><a href="deleteStudent.do?id=${student.id}" οnclick="return check()">删除</a> </td>
<td><a href="toUpdateStudent.do?id=${student.id}&¤tPageIndex=${pagination.currentPageInde}">修改</a> </td>
</tr>
</c:forEach>
</tbody>
</table>
共查询到${pagination.totalCount}条,
共分${pagination.totalPages}页
当前显示第${pagination.startNum}到${pagination.endNum}<br/>
<c:if test="${not pagination.firstPage}">
<%-- <a href="listStudents.do?currentPageIndex=1">首页</a>
<a href="listStudents.do?currentPageIndex=${pagination.currentPageInde-1}">上一页</a>--%>
<a href="javascript:fanye(1)">首页</a>
<a href="javascript:fanye(2)">上一页</a>
</c:if>
<c:if test="${not pagination.lastPage}">
<%--<a href="listStudents.do?currentPageIndex=${pagination.currentPageInde+1}">下一页</a>
<a href="listStudents.do?currentPageIndex=${pagination.totalPages}">末页</a>--%>
<a href="javascript:fanye(3)">下一页</a>
<a href="javascript:fanye(4)">末页</a>
</c:if>
</body>
</html>