package servlet;

import core.process.C_TeacherSelectStudent;
import core.user.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/home/teacher-select-student")
public class S_TeacherSelectStudent extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        super.doPost(request, response);
        String studentId=request.getParameter("id");
        User user=(User)request.getSession().getAttribute("user");
        String teacherId=user.getId();
        try {
            C_TeacherSelectStudent TSS=new C_TeacherSelectStudent();
            TSS.setTeacherId(teacherId);
            TSS.setStudentId(studentId);
            TSS.select();
        } catch (Exception e) {
            e.printStackTrace();
            response.sendRedirect("/op_fail.jsp");
        }
    }
}
