package servlet;

import core.process.C_StudentSelectTeacher;
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/student-select-teacher")
public class S_StudentSelectTeacher extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        super.doPost(request, response);
        String teacherId=request.getParameter("id");
        User user=(User)request.getSession().getAttribute("user");
        String studentId=user.getId();
        try {
            C_StudentSelectTeacher SST=new C_StudentSelectTeacher();
            SST.setTeacherId(teacherId);
            SST.setStudentId(studentId);
            SST.select();
        } catch (Exception e) {
            e.printStackTrace();
            response.sendRedirect("/op_fail.jsp");
        }
    }

}
