<%--
Created by IntelliJ IDEA.
User: 绿波亭
Date: 2023/5/29
Time: 14:24
To change this template use File | Settings | File Templates.
--%>
<%@ page import="wangzhan.*" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<title> 学生功能页 </title>
<style>
body{
background-color: #f2f2f2;
font-family: Arial, sans-serif;
}
.container{
max-width: 800px;
margin: 0 auto;
text-align: center;
padding: 20px 0;
}
h1{
font-size: 36px;
color: #333;
margin-bottom: 20px;
}
table{
font-family: Arial, sans-serif;
border-collapse: collapse;
width: 100%;
margin-bottom: 20px;
}
td, th{
border: 1px solid #ddd;
text-align: center;
padding: 8px;
}
th{
background-color: #4caf50;
color: white;
}
input[type="text"]{
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
label{
display: block;
text-align: left;
font-size: 18px;
margin-bottom: 5px;
color: #333;
}
input[type="submit"]{
background-color: #4caf50;
color: white;
font-size: 18px;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover{
background-color: #37a047;
}
.cout{
margin-right: 7%;
}
</style>
</head>
<body>
<%HttpSession httpSession= request.getSession();
String username= (String) httpSession.getAttribute("username");
String role= (String) httpSession.getAttribute("role");
Thesql thesql=new Thesql();
request.setCharacterEncoding("UTF-8");
String date=request.getParameter("date");
int n = 0;
ArrayList<score> scores = null;
if(date==null){
n=0;
}
else{
scores=thesql.get_score(username,date);
n=scores.size();
}
%>
<div class="container">
<h1> 学生功能 </h1>
<label class="cout">姓名:<%out.print(thesql.get_name(username,role));%></label>
<label class="cout">学号:<%out.print(username);%></label>
<h2>考试成绩
<form action="student.jsp" method="post">
<input type="date" name="date">
<input type="submit" value="查询" style="font-size: 2px;">
<a href="ex.jsp"><button>修改</button></a>
</form>
</h2>
<table>
<tr>
<th>科目</th>
<th>成绩</th>
</tr>
<%for(int i=0;i<n;i++){%>
<tr>
<td><%out.print(scores.get(i).sub);%></td>
<td><%out.print(scores.get(i).sco);%></td>
</tr>
<%}%>
</table>
</div>
</body>
</html>