|
@@ -0,0 +1,242 @@
|
|
|
+<%@page import="java.sql.ResultSet"%>
|
|
|
+<%@page import="java.sql.PreparedStatement"%>
|
|
|
+<%@page import="java.sql.DriverManager"%>
|
|
|
+<%@page import="java.sql.Connection"%>
|
|
|
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
|
|
+<!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>
|
|
|
+ <script>
|
|
|
+ function update(obj){
|
|
|
+ var ocount = document.getElementById('count');
|
|
|
+ var oname = document.getElementById('name');
|
|
|
+ var ogender = document.getElementById('gender');
|
|
|
+ var otelephone = document.getElementById('telephone');
|
|
|
+ var omailbox = document.getElementById('mailbox');
|
|
|
+ var oage = document.getElementById('age');
|
|
|
+ var odepartemnt = document.getElementById('department');
|
|
|
+ var oTr = obj.parentNode.parentNode;
|
|
|
+ var aTd = oTr.getElementsByTagName('td');
|
|
|
+ rowIndex = obj.parentNode.parentNode.rowIndex;
|
|
|
+ ocount.value = aTd[1].innerHTML;
|
|
|
+ oname.value = aTd[2].innerHTML;
|
|
|
+ ogender.value = aTd[3].innerHTML;
|
|
|
+ otelephone.value = aTd[4].innerHTML;
|
|
|
+ omailbox.value = aTd[5].innerHTML;
|
|
|
+ oage.value = aTd[6].innerHTML;
|
|
|
+ odepartment.value = aTd[7].innerHTML;
|
|
|
+ console.log(aTd[4].innerHTML);
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ <style type="text/css">
|
|
|
+ *{
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+ body{
|
|
|
+ padding: 10px 50px;
|
|
|
+ }
|
|
|
+ #wrap{
|
|
|
+ width: 800px;
|
|
|
+ margin: 10px auto;
|
|
|
+ font-family: 'trebuchet MS','Lucida sans',Arial;/*字体效果*/
|
|
|
+ font-size: 14px;
|
|
|
+ color: #444;
|
|
|
+ }
|
|
|
+ table{
|
|
|
+ *border-collapse:collapse;/*border-collapse用于表格属性,表示表格的两边框合并成一条*/
|
|
|
+ border-spacing: 0;/*border-spacing属性设置相邻单元格的边框的距离*/
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ /*======bordered table======*/
|
|
|
+ /*-moz代表firefox浏览器私有属性,-ms代表ie浏览器私有属性,-webkit代表safari、chrome私有属性。这些是为了兼容老版本的写法,比较新版本的浏览器都支持直接写:border-radius。*/
|
|
|
+ .bordered{
|
|
|
+ border: solid #ccc 1px;
|
|
|
+ -moz-border-radius:6px;
|
|
|
+ -webkit-border-radius:6px;
|
|
|
+ border-radius: 6px; /*添加圆角边框:*/
|
|
|
+ -wekit-box-shadow:0 1px 1px #ccc;
|
|
|
+ -moz-box-shadow:0 1px 1px #ccc;
|
|
|
+ box-shadow: 0 1px 1px #ccc; /*向方框添加阴影。*/
|
|
|
+ }
|
|
|
+ .bordered tr{
|
|
|
+ -o-transition:all 0.1s ease-in-out;/*过渡效果*/
|
|
|
+ -webkit-transition:all 0.1s ease-in-out;
|
|
|
+ -moz-transition:all 0.1s ease-in-out;
|
|
|
+ -ms-transition:all 0.1s ease-in-out;
|
|
|
+ transition:all 0.1s ease-in-out;
|
|
|
+ }
|
|
|
+ .bordered highlight,.bordered tr:hover{background: #fbf8e9;} /*hover:当鼠标经过时会颜色的变化*/
|
|
|
+ .bordered td,.bordered th{
|
|
|
+ border-left: 1px solid #ccc;
|
|
|
+ border-top: 1px solid #ccc;
|
|
|
+ padding: 10px;
|
|
|
+ text-align: left; /*左对齐元素中的文本*/
|
|
|
+ }
|
|
|
+ .bordered th{
|
|
|
+ border-color: #dce9f9; /*-webkit safari、chrome私有属性 linear-gradient()函数用于创建一个线性渐变的 "图像"*/
|
|
|
+ background-image: -webkit-gradient(linear,left top,left bottom,from(#ebf3fc),to(#dce9f9));
|
|
|
+ background-image: -webkit-linear-gradient(top,#ebf3fc,#dce9f9);
|
|
|
+ background-image: -moz-linear-gradient(top,#ebf3fc,#dce9f9);
|
|
|
+ background-image: -ms-linear-gradient(top,#ebf3fc,#dce9f9);
|
|
|
+ background-image: -o-linear-gradient(top,#ebf3fc,#dce9f9);
|
|
|
+ background-image: linear-gradient(top,#ebf3fc,#dce9f9);
|
|
|
+ filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#ebf3fc,endColorstr=#dce9f9); /*ie提供的css渲染*/
|
|
|
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#ebf3fc,endColorstr=#dce9f9)";
|
|
|
+ -webkit-box-shadow:0 1px 0 raba(255,255,255,.8) inset; /*ie提供的css渲染*/
|
|
|
+ -moz-box-shadow:0 1px 0 raba(255,255,255,.8) inset;
|
|
|
+ box-shadow:0 1px 0 raba(255,255,255,.8) inset; /*内阴影*/
|
|
|
+ border-top: none;
|
|
|
+ text-shadow:0 1px 0 raba(255,255,255,.5);
|
|
|
+ }
|
|
|
+ .bordered td:first-child,.bordered th:first-child{
|
|
|
+ border-left: none;
|
|
|
+ }
|
|
|
+ .bordered th:first-child{
|
|
|
+ -moz-border-radius:6px 0 0 0;
|
|
|
+ -webkit-border-radius:6px 0 0 0;
|
|
|
+ border-radius:6px 0 0 0;
|
|
|
+ }
|
|
|
+ .bordered th:last-child{
|
|
|
+ -moz-border-radius:0 6px 0 0;
|
|
|
+ -webkit-border-radius:0 6px 0 0;
|
|
|
+ border-radius:0 6px 0 0;
|
|
|
+
|
|
|
+ }
|
|
|
+ .bordered tr:last-child td:first-child{
|
|
|
+ -moz-border-radius:0 0 0 6px;
|
|
|
+ -webkit-border-radius:0 0 0 6px;
|
|
|
+ border-radius:0 0 0 6px;
|
|
|
+ }
|
|
|
+ .bordered tr:last-child td:last-child{
|
|
|
+ -moz-border-radius:0 0 6px 0;
|
|
|
+ -webkit-border-radius:0 0 6px 0;
|
|
|
+ border-radius:0 0 6px 0;
|
|
|
+ }
|
|
|
+ .a{
|
|
|
+ color:blue;
|
|
|
+ }
|
|
|
+ .button{
|
|
|
+ background: url(images/button-bg.png) repeat-x top center;
|
|
|
+ border: 1px solid #999;
|
|
|
+ -moz-border-radius:4px;
|
|
|
+ -webkit-border-radius:4px;
|
|
|
+ border-radius:4px;
|
|
|
+ padding: 5px;
|
|
|
+ color: black;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 13px;
|
|
|
+ width: 70px;
|
|
|
+}
|
|
|
+.button:hover{
|
|
|
+ background: white;
|
|
|
+ color: black;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <h1 align="center">员工信息列表</h1>
|
|
|
+ <div align="right" >
|
|
|
+ <input type="button" value="添加员工" class="button"
|
|
|
+ onclick="javascrtpt:window.location.href = 'add.jsp'">
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <div align="right">欢迎你,
|
|
|
+ <a href="login.jsp">退出</a>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <br>
|
|
|
+
|
|
|
+ <form action="update.jsp" class="bordered">
|
|
|
+ <table align="center">
|
|
|
+ <tr>
|
|
|
+ <td>
|
|
|
+ 姓名:<input type="text" name="name"/>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <input type="submit" value="查询" class="button" onclick="javascrtpt:window.location.href = 'update.jsp'"/>
|
|
|
+ </td>
|
|
|
+
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </form>
|
|
|
+
|
|
|
+
|
|
|
+ <form action="update2.jsp" class="bordered">
|
|
|
+ <table align="center">
|
|
|
+ <tr>
|
|
|
+ <td>
|
|
|
+ 部门:
|
|
|
+ <select name="department">
|
|
|
+ <option value="人力部" >人力部</option>
|
|
|
+ <option value="生活部" >生活部</option>
|
|
|
+ <option value="活动部" >活动部</option>
|
|
|
+ <option value="财务部" >财务部</option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+
|
|
|
+ <td>
|
|
|
+ <input type="submit" value="查询" class="button" onclick="javascrtpt:window.location.href = 'update2.jsp'" />
|
|
|
+ </td>
|
|
|
+</tr>
|
|
|
+ </table>
|
|
|
+ </form>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <%
|
|
|
+ String driver = "com.mysql.cj.jdbc.Driver";
|
|
|
+ String url = "jdbc:mysql://localhost:3306/edu?characterEncoding=utf-8"
|
|
|
+ + "&serverTimezone=UTC";
|
|
|
+ String usr = "root";
|
|
|
+ String password = "1234";
|
|
|
+
|
|
|
+ Class.forName(driver);
|
|
|
+ Connection conn = DriverManager.getConnection(url, usr, password);
|
|
|
+ String sqlString = "select * from manager1";
|
|
|
+ PreparedStatement pstmt = conn.prepareStatement(sqlString);
|
|
|
+ ResultSet rs = pstmt.executeQuery();
|
|
|
+ %>
|
|
|
+
|
|
|
+ <table border=1 style="margin:auto" class="bordered">
|
|
|
+ <tr>
|
|
|
+ <th class="listTable" id="count">序号</th>
|
|
|
+ <th class="listTable" id="name">姓名</th>
|
|
|
+ <th class="listTable" id="gender">性别</th>
|
|
|
+ <th class="listTable" id="telephone">电话</th>
|
|
|
+ <th class="listTable" id="mailbox">邮箱</th>
|
|
|
+ <th id="profile" id="age">年龄</th>
|
|
|
+ <th id="operate" id="department">部门</th>
|
|
|
+ <th>操作</th>
|
|
|
+
|
|
|
+ </tr>
|
|
|
+
|
|
|
+
|
|
|
+ <%
|
|
|
+ while (rs.next()) {
|
|
|
+ out.println("<tr>");
|
|
|
+ out.println("<td >" + rs.getString("count") + "</td>");
|
|
|
+ out.println("<td >" + rs.getString("name") + "</td>");
|
|
|
+ out.println("<td>" + rs.getString("gender") + "</td>");
|
|
|
+ out.println("<td>" + rs.getString("telephone") + "</td>");
|
|
|
+ out.println("<td>" + rs.getString("mailbox") + "</td>");
|
|
|
+ out.println("<td>" + rs.getInt("age") + "</td>");
|
|
|
+ out.println("<td>" + rs.getString("department") + "</td>");
|
|
|
+ out.println("<td><div><a href='../delete?count=" + rs.getString("count") + "'><button>删除</button></a></div><div><a href='change.jsp?count=" + rs.getString("count") + "'><button>修改</button></a></div></td>");
|
|
|
+ out.println("</tr>");
|
|
|
+ }
|
|
|
+ %>
|
|
|
+ </table>
|
|
|
+
|
|
|
+ </body>
|
|
|
+</html>
|
|
|
+
|
|
|
+
|