@RequestMapping(value = "Login", method = RequestMethod.POST)
 public String login(
     @RequestParam(value = "no") String no,
     @RequestParam(value = "password") String password,
     HttpSession session,
     RedirectAttributes attr) {
   Student getS = this.studentService.selectByNo(no);
   boolean student = (getS != null) ? getS.getPassword().equals(password) : false;
   Teacher getT = this.teacherService.selectByNo(no);
   boolean teacher = (getT != null) ? getT.getPassword().equals(password) : false;
   Administrator getA = this.administratorService.selectByNo(no);
   boolean administrator = (getA != null) ? getA.getPassword().equals(password) : false;
   boolean exist = student || teacher || administrator;
   String identity =
       student ? "Student" : teacher ? "Teacher" : administrator ? "Administrator" : "";
   if (exist) {
     session.setAttribute("login", no);
     session.setAttribute("identity", identity);
   } else {
     session.setAttribute("login", "error");
     return "redirect:/";
   }
   switch (identity) {
     case "Student":
       session.setAttribute("Id", getS.getNo());
       session.setAttribute("username", getS.getName());
       session.setAttribute("btlink", "ContestSystem/Student/Registration");
       break;
     case "Teacher":
       session.setAttribute("Id", getT.getNo());
       session.setAttribute("username", getT.getName());
       session.setAttribute("btlink", "ContestSystem/Declaration");
       break;
     case "Administrator":
       session.setAttribute("no", getA.getNo());
       session.setAttribute("username", getA.getNo());
       session.setAttribute("btlink", "ContestSystem/Administrator");
       break;
   }
   Object obj = this.userService.getUserByKey("no", no);
   String UserType = obj.getClass().getSimpleName();
   switch (UserType) {
     case "Administrator":
       break;
     case "Teacher":
       attr.addFlashAttribute("UserBtnLink", "Declaration");
       break;
     case "Student":
       attr.addFlashAttribute("UserBtnLink", "Registration");
       break;
     default:
   }
   attr.addFlashAttribute("User", obj);
   attr.addFlashAttribute("UserType", UserType);
   return "redirect:/";
 }
 @RequestMapping(value = "SignUp")
 public String SignUp(
     String createAccount,
     String IdNumber,
     String name,
     String createPassword,
     HttpSession session,
     RedirectAttributes attr) {
   Student student = new Student();
   student.setNo(createAccount);
   student.setID(IdNumber);
   student.setName(name);
   student.setPassword(createPassword);
   this.studentService.create(student);
   return login(createAccount, createPassword, session, attr);
 }