diff --git a/.idea/artifacts/GDMS_war_exploded.xml b/.idea/artifacts/GDMS_war_exploded.xml index 6b1fe0c..12d7fe5 100644 --- a/.idea/artifacts/GDMS_war_exploded.xml +++ b/.idea/artifacts/GDMS_war_exploded.xml @@ -7,6 +7,9 @@ + + + diff --git a/src/servlet/S_TeacherSelectStudent.java b/src/servlet/S_TeacherSelectStudent.java new file mode 100644 index 0000000..1ebed38 --- /dev/null +++ b/src/servlet/S_TeacherSelectStudent.java @@ -0,0 +1,24 @@ +package servlet; + +import core.process.C_TeacherSelectStudent; +import core.user.User; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class S_TeacherSelectStudent extends HttpServlet { + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + super.doPost(request, response); + String teacher_id=request.getParameter("id"); + User user=(User)request.getSession().getAttribute("User"); + String student_id=user.getId(); + try { + new C_TeacherSelectStudent().select(teacher_id,student_id); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/servlet/account/S_Register.java b/src/servlet/account/S_Register.java index f0f7077..b3397fb 100644 --- a/src/servlet/account/S_Register.java +++ b/src/servlet/account/S_Register.java @@ -1,4 +1,46 @@ package servlet.account; -public class S_Register { -} +import core.user.User; +import core.user.utils.AccountManagement; +import error.GExcptAccount; +import error.GExcptSQL; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +public class S_Register extends HttpServlet { + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + super.doPost(request, response); + Map user_info=new HashMap<>(); + String id=request.getParameter("id"); + user_info.put("id",id); + String name=request.getParameter("name"); + user_info.put("name",name); + String e_mail=request.getParameter("e-mail"); + user_info.put("e_mail",e_mail); + String phone_number=request.getParameter("phone-number"); + user_info.put("phone_number",phone_number); + String password=request.getParameter("password"); + user_info.put("password",password); + User user=null; + try { + user = AccountManagement.register("student",user_info); + } catch (GExcptSQL gExcptSQL) { + gExcptSQL.printStackTrace(); + } catch (GExcptAccount gExcptAccount) { + gExcptAccount.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + //注册失败 + request.getSession().setAttribute("User",user); + request.getRequestDispatcher("/home.jsp").forward(request,response); + + } +} \ No newline at end of file diff --git a/src/servlet/account/login.java b/src/servlet/account/login.java index 12a8cd0..08269c3 100644 --- a/src/servlet/account/login.java +++ b/src/servlet/account/login.java @@ -33,8 +33,6 @@ public class login extends HttpServlet { } request.getSession().setAttribute("User",user); request.getRequestDispatcher("/home.jsp").forward(request,response); - request.getSession().setAttribute("User",user); - request.getRequestDispatcher("/home.jsp").forward(request,response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) diff --git a/src/servlet/basic_settings/S_Listener.java b/src/servlet/basic_settings/S_Listener.java new file mode 100644 index 0000000..84b0026 --- /dev/null +++ b/src/servlet/basic_settings/S_Listener.java @@ -0,0 +1,4 @@ +package servlet.basic_settings; + +public class S_Listener { +} diff --git a/web/login.jsp b/web/login.jsp index 82983d5..92fda2b 100644 --- a/web/login.jsp +++ b/web/login.jsp @@ -56,7 +56,7 @@ diff --git a/web/select.jsp b/web/select.jsp index d214f7b..640a15f 100644 --- a/web/select.jsp +++ b/web/select.jsp @@ -25,7 +25,7 @@
-
+
c
李先生