parent
a96fc2bb1a
commit
3c1d9b6906
@ -0,0 +1,46 @@
|
||||
package servlet.account;
|
||||
|
||||
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<String,String> 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);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package servlet.select;
|
||||
|
||||
import core.process.C_StudentSearchTeacher;
|
||||
import core.process.C_StudentSelectTeacher;
|
||||
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_StudentSelectTeacher extends HttpServlet {
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
super.doPost(request, response);
|
||||
String student_id=request.getParameter("id");
|
||||
User user=(User)request.getSession().getAttribute("User");
|
||||
String teacher_id=user.getId();
|
||||
try {
|
||||
new C_StudentSelectTeacher().select(student_id,teacher_id);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package servlet.select;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue