5.31每日总结

发布时间 2023-05-31 22:09:12作者: 风·华正茂
今天又重新弄了弄周一考试的题,然后找了几个
认识的朋友下载了以下简单测试。

<%@ page import="wangzhan.Thesql" %> <%@ page import="wangzhan.Pd_P_assignment" %> <%@ page import="wangzhan.Pd_S_assignment" %> <%@ 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"> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>教学管理平台</title> <style> body { font-family: Arial, sans-serif; background-color: #f7f7f7; } h1 { color: #333; text-align: center; margin-top: 50px; } table { margin: 0 auto; border-collapse: collapse; box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); background-color: #fff; } th, td { padding: 30px; text-align: center; border: 1px solid #ddd; font-size: 17px; } th { background-color: #8b8989; color: #fff; font-size: 30px; } tr:nth-child(even) { background-color: #f2f2f2; } input{ border: none; border-radius: 10px; height: 27px; } .submit{ background-color: rgb(26, 131, 201); color: aliceblue; height: 50px; width: 90%; } .submit:active{ background-color: rgb(166, 172, 175); } a{ text-decoration: none; font-size: 20px; color: #3bc9e2; } /* 翻页选中样式 */ .active { color: white; background-color: #007bff; border-radius: 0.25rem; padding: 0.5rem; text-decoration: none; margin-right: 10px; } /* 翻页未选中样式 */ a.page-link { color: #007bff; text-decoration: none; margin-right: 10px; } #pagination{ text-align: center; } </style> </head> <% Thesql thesql = new Thesql(); request.setCharacterEncoding("UTF-8"); String les=""; String pu=""; String stu=""; les=request.getParameter("les"); pu=request.getParameter("pu"); stu=request.getParameter("stu"); Pd_S_assignment pd[] = thesql.S_assignment_DimQuery("","","","","","",pu,les,stu); int itemsPerPage = 5;//每页展示多少条 int totalItems = pd.length;//总共多少条 int currentPage = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page")); int totalPages = (int) Math.ceil(totalItems / (double)itemsPerPage); int startItem = (currentPage - 1) * itemsPerPage + 1; int endItem = Math.min(startItem + itemsPerPage - 1, totalItems); %> <body> <table> <tr> <form action="Browse_Sexperiment.jsp" method="post"> <th>课程:<input type="text" name="les"></th> <th>名称:<input type="text" name="pu"></th> <th>学生:<input type="text" name="stu"></th> <th><input class="submit" type="submit"></th> </form> </tr> <% for (int i = startItem; i < endItem; i++) { %> <tr> <td><%=pd[i].getLesson_name()%></td> <td><%=thesql.P_assignment_query(pd[i].getPu_ass_id()).getType()%>:<%=pd[i].getPu_name()%></td> <td><%=pd[i].getStudent_name()%></td> <td><a href="Submit_experiment.jsp?exp_id=<%=pd[i].getId()%> &les_id=<%=thesql.P_assignment_query(pd[i].getPu_ass_id()).getLesson_id()%>">查看</a></td> </tr> <% }%> </table> <br> <% if(!(les!=null)) les=""; if(!(pu!=null)) pu=""; if(!(stu!=null)) stu=""; %> <div id="pagination"> <%-- 显示翻页链接 --%> <%-- &les=<%=les%>&pu=<%=pu%>&stu=<%=stu%>--%> <a href="?page=<%= Math.max(1, currentPage - 1) %>&les=<%=les%>&pu=<%=pu%>&stu=<%=stu%>" <%= currentPage == 1 ? "class=\"disabled page-link\"" : "class=\"page-link\"" %> >&laquo; 上一页</a> <% for (int i = 1; i <= totalPages; i++) { %> <a href="?page=<%= i %>&les=<%=les%>&pu=<%=pu%>&stu=<%=stu%>" <%= i == currentPage ? "class=\"active\"" : "class=\"page-link\"" %> ><%= i %></a> <% } %> <a href="?page=<%= Math.min(currentPage + 1, totalPages) %>&les=<%=les%>&pu=<%=pu%>&stu=<%=stu%>" <%= currentPage == totalPages ? "class=\"disabled page-link\"" : "class=\"page-link\"" %> >下一页 &raquo;</a> </div> </body>> </html>