AI智能解答
teacher.setCertificateValidity(certificateValidity);
//可以授课科目
teacher.setCourse(expertCourse(highestDegree));
//教师id
teacher.setTeacherId(teacherId);
//教师类型
teacher.setTeacherType(teacherType);
//头像地址
teacher.setPhoto(photo);
//简介
teacher.setProfile(profile);
//期望月薪
teacher.setExpectedSalary(expectedSalary);
//期望时段
teacher.setExpectedPeriod(expectedPeriod);
//教学经验
teacher.setTeachingExperience(teachingExperience);
//教师状态
teacher.setTeacherStatus(teacherStatus);
//授课状态
teacher.setProfessionStatus(professionStatus);
//用户id
teacher.setUserId(userId);
//Adding teacherInfo to entity
entity=new ArrayList();
entity.add(teacher);
/**
* 传入学科参数,进行页面元素加载
*/
//载入学科
subjectService.setSubjectTag(request);
//载入家教类型
teacherTypeService.setTeacherTypeTag(request);
request.setAttribute("subjectId", subjectId);
/**
* 页面跳转
*/
url="teacher";
break;
case "delete":
//Execute deleting operation
int deleteId=Integer.parseInt(request.getParameter("teacherId"));
teacherService.deleteById(deleteId);
/**
* 传入学科参数,进行页面元素加载
*/
//载入学科
subjectService.setSubjectTag(request);
//载入家教类型
teacherTypeService.setTeacherTypeTag(request);
request.setAttribute("subjectId", subjectId);
/**
* 页面跳转
*/
url="teacher";
break;
default:
//Operator illegal
msg="非法操作!";
url="login.jsp";
}
}
/**
* 页面跳转
*/
//信息保存到request域
request.setAttribute("msg", msg);
request.setAttribute("entity", entity);
//转发
RequestDispatcher rd=request.getRequestDispatcher(url);
rd.forward(request, response);
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* This is searching method
* @param highestDegree
* @return
*/
private String expertCourse(String highestDegree) {
String course=null;
switch (highestDegree) {
case "大专":
course="初中数学、初中语文、初中英语、初中物理";
break;
case "本科":
course="初、高中数学、初、高中语文、初、高中英语、初、高中物理";
break;
case "硕士":
course="初、高中数学、初、高中语文、初、高中英语、初、高中物理、初、高中化学";
break;
case "博士":
course="初、高中数学、初、高中语文、初、高中英语、初、高中物理、初、高中化学、初、高中生物";
break;
default:
break;
}
return course;
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}