<%--
  Created by IntelliJ IDEA.
  User: vie
  Date: 2019/12/30
  Time: 8:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,
    minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>学生信息管理</title>
</head>
<body>
<%
    String driver = "com.mysql.cj.jdbc.Driver";
    String url = "jdbc:mysql://localhost:3306/test?characterEncoding=utf-8"
            +"&serverTimezone=GMT"+ "&useUnicode=true"+"&useSSL=false" ;
    String usr = "root";
    String password = "123456";
    Class.forName("com.mysql.cj.jdbc.Driver");
    Connection conn = DriverManager.getConnection(url, usr, password);
    String sqlString = "select * from admin";
    PreparedStatement pstmt = conn.prepareStatement(sqlString);
    ResultSet rs = pstmt.executeQuery();
%>
<div align="right" style="color: lavender">欢迎你，<%=request.getParameter("Username")%></div>
<center>
    <table width="900" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td height="60" bgcolor="#E6F5FF" style="color:#06F; font-size:19px; font-weight:bolder; padding-left:50px;">高校公寓管理系统</td>
    </tr>
    <tr>
        <td height="30" background="Images/MenuBg.jpg">&nbsp;</td>
    </tr>
    <tr>
        <td height="500" align="center" valign="top"><table width="900" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="191" height="500" align="center" valign="top" background="Images/leftbg.jpg">
                    <%@ include file="ManagerLeft.jsp"%>
                </td>
                <td width="709" align="center" valign="top" bgcolor="#F6F9FE"><table width="709" border="10" cellspacing="0" cellpadding="0" style="margin: auto">
                    <caption><h3>学生基本信息</h3></caption>
                    <tr>
                        <td class="listTable">学号</td>
                        <td class="listTable">登陆密码</td>
                        <td class="listTable">姓名</td>
                        <td class="listTable">电话</td>
                        <td id="operate">操作</td>
                    </tr>
                    <%
                        while (rs.next()) {
                            out.println("<tr>");
                            out.println("<td>" + rs.getInt("Admin_id") + "</td>");
                            out.println("<td>" + rs.getString("Admin_password") + "</td>");
                            out.println("<td>" + rs.getString("Admin_name") + "</td>");
                            out.println("<td>" + rs.getString("Admin_tel") + "</td>");
                            out.println("<td><a href='http://localhost:8080/StudentManageSystem_war_exploded/DeleteServlet?id=" + rs.getInt("Admin_id")+ "'>删除</a></td>");
                            out.println("</tr>");
                        }
                    %>
                    <div align="right" >
                        <input type="button" style="color: darkslateblue" value="添加学生" onclick="javascript:window.location.href = 'StudentAdd.jsp'">
                    </div>
                    <br>
                </td>
            </tr>
        </table>
                </td>
            </tr>
        </table>
        </td>
    </tr>
    </table>
    <tr>
        <td height="35" background="Images/bootBg.jpg">&nbsp;</td>
    </tr>
</center>
<div align="center" style="width: 100%;position: fixed;bottom: 0;color:yellow">
    <%!Date time= new Date();%>
    <%
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日 E HH时mm分ss秒");
    %>
    <h3><% out.println(sdf1.format(time)); %></h3>
</div>
</body>
</html>
