第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

正在回答

1 回答

<%@ page language="java" contentType="text/html; charset=UTF-8"
??? pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>學(xué)生信息</title>
</head>
<%
?? ?// 獲取請求的上下文
?? ?String context = request.getContextPath();
%>
<script type="text/javascript">
// 當(dāng)前第幾頁數(shù)據(jù)
var currentPage = ${result.currentPage};

// 總頁數(shù)
var totalPage = ${result.totalPage};

function submitForm(actionUrl){
?? ?var formElement = document.getElementById("stuForm");
?? ?formElement.action = actionUrl;
?? ?formElement.submit();
}

// 第一頁
function firstPage(){
?? ?if(currentPage == 1){
?? ??? ?alert("已經(jīng)是第一頁數(shù)據(jù)");
?? ??? ?return false;
?? ?}else{
?? ??? ?submitForm("<%=context %>/sublist/SublistServlet?pageNum=1");
?? ??? ?return true;
?? ?}
}

// 下一頁
function nextPage(){
?? ?if(currentPage == totalPage){
?? ??? ?alert("已經(jīng)是最后一頁數(shù)據(jù)");
?? ??? ?return false;
?? ?}else{
?? ??? ?submitForm("<%=context %>/sublist/SublistServlet?pageNum=" + (currentPage+1));
?? ??? ?return true;
?? ?}
}

// 上一頁
function previousPage(){
?? ?if(currentPage == 1){
?? ??? ?alert("已經(jīng)是第一頁數(shù)據(jù)");
?? ??? ?return false;
?? ?}else{
?? ??? ?submitForm("<%=context %>/sublist/SublistServlet?pageNum=" + (currentPage-1));
?? ??? ?return true;
?? ?}
}

// 尾頁
function lastPage(){
?? ?if(currentPage == totalPage){
?? ??? ?alert("已經(jīng)是最后一頁數(shù)據(jù)");
?? ??? ?return false;
?? ?}else{
?? ??? ?submitForm("<%=context %>/sublist/SublistServlet?pageNum=${result.totalPage}");
?? ??? ?return true;
?? ?}
}
function initPage(){
?? ?var genderRequest = "${gender}" ;
?? ?var genderVal = 0;
?? ?var genderElement = document.getElementById("gender");
?? ?if(genderRequest != ""){
?? ??? ?genderVal = parseInt(genderRequest);
?? ?}
?? ?
?? ?var options = genderElement.options;
?? ?var i = 0;
?? ?for(i = 0; i < options.length; i++){
?? ??? ?if(options[i].value == genderVal){
?? ??? ??? ?options[i].selected=true;
?? ??? ??? ?break;
?? ??? ?}
?? ?}
?? ?
}
</script>
<body onload="initPage();">
?? ?<div style="margin-left: 100px; margin-top: 100px;">
?? ??? ?<div>
?? ??? ??? ?<font color="red">${errorMsg }</font>
?? ??? ?</div>
?? ??? ?<div>
?? ??? ??? ?<form action="<%=context %>/sublist/SublistServlet"?? id="stuForm"? method="post">
?? ??? ??? ??? ?姓名
?? ??? ??? ??? ?<input type="text" name="stuName" id="stu_name" style="width:120px" value="${stuName }">
?? ??? ??? ??? ?&nbsp;
?? ??? ??? ??? ?性別
?? ??? ??? ??? ?<select name="gender" id="gender" style="width:80px">
?? ??? ??? ??? ??? ?<option value="0">全部</option>
?? ??? ??? ??? ??? ?<option value="1">男</option>
?? ??? ??? ??? ??? ?<option value="2">女</option>
?? ??? ??? ??? ?</select>
?? ??? ??? ??? ?&nbsp;&nbsp;
?? ??? ??? ??? ?<input type="submit" value="查詢">
?? ??? ??? ?</form>
?? ??? ?</div>?? ??? ?
?? ??? ?<br>
?? ??? ?學(xué)生信息列表:<br>
?? ??? ?<br>
?? ??? ?<!-- 后臺返回結(jié)果為空 -->
?? ??? ?<c:if test="${fn:length(result.dataList) eq 0 }">
?? ??? ??? ?<span>查詢的結(jié)果不存在</span>
?? ??? ?</c:if>
?? ??? ?
?? ??? ?<!-- 后臺返回結(jié)果不為空 -->
?? ??? ?<c:if test="${fn:length(result.dataList) gt 0 }">
?? ??? ??? ?<table border="1px" cellspacing="0px"
?? ??? ??? ??? ?style="border-collapse: collapse">
?? ??? ??? ??? ?<thead>
?? ??? ??? ??? ??? ?<tr height="30">
?? ??? ??? ??? ??? ??? ?<th width="130">姓名</th>
?? ??? ??? ??? ??? ??? ?<th width="130">性別</th>
?? ??? ??? ??? ??? ??? ?<th width="130">年齡</th>
?? ??? ??? ??? ??? ??? ?<th width="190">家庭地址</th>
?? ??? ??? ??? ??? ?</tr>
?? ??? ??? ??? ?</thead>
?? ??? ??? ??? ??? ?<c:forEach items="${result.dataList }" var="student">
?? ??? ??? ??? ??? ??? ?<tr>
?? ??? ??? ??? ??? ??? ??? ?<td><c:out value="${student.stuName }"></c:out></td>
?? ??? ??? ??? ??? ??? ??? ?<td>
?? ??? ??? ??? ??? ??? ??? ??? ?<c:if test="${ student.gender eq 1}">男</c:if>
?? ??? ??? ??? ??? ??? ??? ??? ?<c:if test="${ student.gender eq 2}">女</c:if>
?? ??? ??? ??? ??? ??? ??? ?</td>
?? ??? ??? ??? ??? ??? ??? ?<td><c:out value="${student.age }"></c:out></td>
?? ??? ??? ??? ??? ??? ??? ?<td><c:out value="${student.address }"></c:out></td>
?? ??? ??? ??? ??? ??? ?</tr>
?? ??? ??? ??? ??? ?</c:forEach>
?? ??? ??? ?</table>
?? ??? ??? ?<br> 共${result.totalRecord }條記錄共${result.totalPage }頁&nbsp;&nbsp;當(dāng)前第${result.currentPage }頁&nbsp;&nbsp;
?? ??? ??? ?<a href="#" onclick="firstPage();">首頁</a>&nbsp;&nbsp;
?? ??? ??? ?<a href="#" onclick="nextPage();">下一頁</a>&nbsp;&nbsp;
?? ??? ??? ?<a href="#" onclick="previousPage();">上一頁</a>&nbsp;&nbsp;
?? ??? ??? ?<a href="#" onblur="lastPage();">尾頁</a>?? ?
?? ??? ?</c:if>
?? ?</div>
</body>
</html>

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
Java 分頁原理與實踐(上)
  • 參與學(xué)習(xí)       65014    人
  • 解答問題       150    個

通過總結(jié)常見的分頁樣式,手把手帶你實現(xiàn)java常見的分頁功能

進入課程

sublistStudent.jsp的代碼

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號