diff --git a/WebRoot/JSPhandle/admin_update.jsp b/WebRoot/JSPhandle/admin_update.jsp index 8a150be..3b72f9a 100644 --- a/WebRoot/JSPhandle/admin_update.jsp +++ b/WebRoot/JSPhandle/admin_update.jsp @@ -32,6 +32,7 @@ String name = request.getParameter("adminname"); String adminsex = request.getParameter("sex"); String adminjob = request.getParameter("job"); + String oldname = request.getParameter("OldAdminName"); %> <% String driver = "com.mysql.jdbc.Driver"; @@ -42,11 +43,12 @@ try{ Connection conn = DriverManager.getConnection(url, use, password); PreparedStatement sql = conn - .prepareStatement("update adminstrator_record set AdminNo=?,AdminSex=?,AdminJob=? where AdminName=?"); + .prepareStatement("update adminstrator_record set AdminNo=?,AdminSex=?,AdminJob=?,AdminName=? where AdminName=?;"); sql.setString(1, adminNo); sql.setString(2, adminsex); sql.setString(3, adminjob); sql.setString(4, name); + sql.setString(5, oldname); int rtn = sql.executeUpdate(); if (rtn != 0) { flag = true; @@ -65,6 +67,11 @@ <% } else if (flag == false) { %> +<%-- <%=adminNo %> + <%=adminsex %> + <%=adminjob %> + <%=name %> + <%=oldname %> --%> <% } diff --git a/WebRoot/JSPhandle/adminjob_update.jsp b/WebRoot/JSPhandle/adminjob_update.jsp new file mode 100644 index 0000000..75677dc --- /dev/null +++ b/WebRoot/JSPhandle/adminjob_update.jsp @@ -0,0 +1,71 @@ +<%@ page language="java" import="java.sql.*" + contentType="text/html;charset=utf-8"%> +<% + String path = request.getContextPath(); + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + + path + "/"; +%> + + + + + + +检验插入页面 + + + + + + + + + + +
+ <% + boolean flag = false; + request.setCharacterEncoding("utf-8"); + String Adminjob = request.getParameter("Adminjob"); + String Adminduty = request.getParameter("jobduty"); + String oldname = request.getParameter("OldAdminJob"); + %> + <% + String driver = "com.mysql.jdbc.Driver"; + String url = "jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8"; + String use = "root"; + String password = ""; + Class.forName(driver); + try{ + Connection conn = DriverManager.getConnection(url, use, password); + PreparedStatement sql = conn + .prepareStatement("update administrator_job set AdminJob=?,AdminDuty=? where AdminJob=?"); + sql.setString(1, Adminjob); + sql.setString(2, Adminduty); + sql.setString(3, oldname); + int rtn = sql.executeUpdate(); + if (rtn != 0) { + flag = true; + } + sql.close(); + conn.close(); + }catch (Exception ex) { + ex.printStackTrace(); + } + %> + + <% + if (flag == true) { + %> + + <% + } else if (flag == false) { + %> + + <% + } + %> + + diff --git a/WebRoot/change_adminjob.jsp b/WebRoot/change_adminjob.jsp new file mode 100644 index 0000000..18d9b4b --- /dev/null +++ b/WebRoot/change_adminjob.jsp @@ -0,0 +1,88 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.*"%> +<%@page import="java.sql.DriverManager"%> + + + + + + +学生管理 + + + + + + + <%@ include file="/module/top.jsp"%> + <%@ include file="/module/limits_check.jsp"%> +
+ <% + if (session.getAttribute("actualuser") == null) { + out.println(""); + return; + } + Object actualuser = session.getAttribute("actualuser"); + %> +
+ <%@ include file="module/sidebar.jsp"%> + +

修改岗位

+
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ + <%@ include file="module/footer.jsp"%> + +
+ + + + \ No newline at end of file diff --git a/WebRoot/edit_admin.jsp b/WebRoot/edit_admin.jsp index 6f83c56..7126b0b 100644 --- a/WebRoot/edit_admin.jsp +++ b/WebRoot/edit_admin.jsp @@ -45,53 +45,66 @@

修改管理员

- <% - try { - ResultSet rs = null; - Connection conn = null; - PreparedStatement sql = null; - conn = DriverManager.getConnection(url, user, password); - Statement stmt = conn.createStatement(); - sql = conn.prepareStatement("select * from adminstrator_record where AdminName=?"); - sql.setString(1, adminName); - rs = sql.executeQuery(); - while (rs.next()) { - %> + <% + try { + ResultSet rs = null; + Connection conn = null; + PreparedStatement sql = null; + conn = DriverManager.getConnection(url, user, password); + Statement stmt = conn.createStatement(); + sql = conn.prepareStatement("select * from adminstrator_record where AdminName=?"); + sql.setString(1, adminName); + rs = sql.executeQuery(); + while (rs.next()) { + %>
+
+ +
+ " name="OldAdminName" + id="disabledTextInput" value="<%=rs.getString("AdminName")%>" + readonly> + +
+
" name="adminno" value='<%=rs.getString("AdminNo")%>'> + placeholder="<%=rs.getString("AdminNo")%>" name="adminno" + value='<%=rs.getString("AdminNo")%>'>
- + - + placeholder='<%=rs.getString("AdminName")%>' name="adminname" + value='<%=rs.getString("AdminName")%>'> +
" name="sex" value='<%=rs.getString("AdminSex")%>'> + placeholder="<%=rs.getString("AdminSex")%>" name="sex" + value='<%=rs.getString("AdminSex")%>'>
<% - } - sql.close(); - rs.close(); - conn.close(); - stmt.close(); - } catch (Exception ex) { - ex.printStackTrace(); - } - %> + } + sql.close(); + rs.close(); + conn.close(); + stmt.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } + %>
@@ -99,8 +112,8 @@ <% try { ResultSet rs = null; - Connection conn = null; - PreparedStatement sql = null; + Connection conn = null; + PreparedStatement sql = null; conn = DriverManager.getConnection(url, user, password); Statement stmt = conn.createStatement(); sql = conn.prepareStatement("select * from administrator_job"); @@ -110,10 +123,10 @@ <% } - sql.close(); - rs.close(); - conn.close(); - stmt.close(); + sql.close(); + rs.close(); + conn.close(); + stmt.close(); } catch (Exception ex) { ex.printStackTrace(); } diff --git a/WebRoot/edit_adminjob.jsp b/WebRoot/edit_adminjob.jsp new file mode 100644 index 0000000..692bc2e --- /dev/null +++ b/WebRoot/edit_adminjob.jsp @@ -0,0 +1,117 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@page import="java.sql.Connection"%> +<%@page import="java.sql.*"%> +<%@page import="java.sql.DriverManager"%> + + + + + + +学生管理 + + + + + + + <%@ include file="/module/top.jsp"%> + <%@ include file="/module/limits_check.jsp"%> +
+ <% + boolean flag = false; + request.setCharacterEncoding("utf-8"); + String AdminJob = request.getParameter("AdminJob"); + %> + <% + if (session.getAttribute("actualuser") == null) { + out.println(""); + return; + } + Object actualuser = session.getAttribute("actualuser"); + String driverClass = "com.mysql.jdbc.Driver"; + String url = "jdbc:mysql://localhost:3306/db_school?useUnicode=true&characterEncoding=utf-8"; + String user = "root"; + String password = ""; + Class.forName(driverClass); + %> + + + + +
+ <%@ include file="module/sidebar.jsp"%> + +

修改岗位

+
+ <% + try { + ResultSet rs = null; + Connection conn = null; + PreparedStatement sql = null; + conn = DriverManager.getConnection(url, user, password); + Statement stmt = conn.createStatement(); + sql = conn.prepareStatement("select * from administrator_job where AdminJob=?"); + sql.setString(1, AdminJob); + rs = sql.executeQuery(); + while (rs.next()) { + %> + +
+ +
+ " name="OldAdminJob" + id="disabledTextInput" value="<%=rs.getString("AdminJob")%>" + readonly> + +
+
+
+ +
+ " name="Adminjob" + value='<%=rs.getString("AdminJob")%>'> +
+
+
+ +
+ + + + +
+
+ <% + } + sql.close(); + rs.close(); + conn.close(); + stmt.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } + %> +
+
+ +
+
+ +
+
+ + <%@ include file="module/footer.jsp"%> + +
+ + + + \ No newline at end of file diff --git a/WebRoot/edit_user.jsp b/WebRoot/edit_user.jsp index 040cf0f..e284245 100644 --- a/WebRoot/edit_user.jsp +++ b/WebRoot/edit_user.jsp @@ -47,10 +47,10 @@
<% try { - ResultSet rs = null; - Connection conn = null; - PreparedStatement sql = null; - + ResultSet rs = null; + Connection conn = null; + PreparedStatement sql = null; + conn = DriverManager.getConnection(url, user, password); Statement stmt = conn.createStatement(); sql = conn.prepareStatement("select userName,Email, VIP,Administrator from show_user where userName=?"); @@ -75,7 +75,8 @@
+ placeholder='<%=rs.getString("userName")%>' name="userName" + value='<%=rs.getString("userName")%>'>
@@ -83,7 +84,8 @@
" name="Email" value='<%=rs.getString("Email")%>'> + placeholder="<%=rs.getString("Email")%>" name="Email" + value='<%=rs.getString("Email")%>'>
@@ -123,10 +125,10 @@
<% } - sql.close(); - rs.close(); - conn.close(); - stmt.close(); + sql.close(); + rs.close(); + conn.close(); + stmt.close(); } catch (Exception ex) { ex.printStackTrace(); } diff --git a/WebRoot/module/limits_check.jsp b/WebRoot/module/limits_check.jsp index bdc981f..f4e2240 100644 --- a/WebRoot/module/limits_check.jsp +++ b/WebRoot/module/limits_check.jsp @@ -6,7 +6,6 @@ %> <% -Object LimitsName = "管理员"; if (!adminuser.equals("管理员")) {/* 已在top.jsp中声明,此处报错正常 */ out.println(""); /* out.println(adminuser); */