# Conflicts: # GDMS.iml # src/servlet/account/login.javawlf
commit
7e7a4a96bb
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,46 @@
|
|||||||
package servlet.account;
|
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<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,4 @@
|
|||||||
|
package servlet.basic_settings;
|
||||||
|
|
||||||
|
public class S_Listener {
|
||||||
|
}
|
Loading…
Reference in new issue