@RequestMapping(value = "/init", method = RequestMethod.GET) public String init(ModelMap model) { if (studentSystem == null) { model.addAttribute("message", "Error filling in data. studentSystem == null"); } else { int john = studentSystem.addStudent("John McClane"); int jane = studentSystem.addStudent("Jane Fonda"); int inf5750 = studentSystem.addCourse("INF5750", "Open Source Development"); int inf5761 = studentSystem.addCourse("INF5761", "Health management information systems"); int master = studentSystem.addDegree("Master"); int bachelor = studentSystem.addDegree("Bachelor"); int phd = studentSystem.addDegree("PhD"); studentSystem.addAttendantToCourse(inf5750, john); studentSystem.addAttendantToCourse(inf5750, jane); studentSystem.addAttendantToCourse(inf5761, john); studentSystem.addAttendantToCourse(inf5761, jane); studentSystem.addRequiredCourseToDegree(master, inf5761); model.addAttribute("message", "Filled in data OK"); } model.addAttribute("message", "Filling in data"); populateModel(model); return "index"; }
@RequestMapping(value = "/course/new", method = RequestMethod.POST) public String createCourse( ModelMap model, @RequestParam("name") String name, @RequestParam("coursecode") String courseCode) { studentSystem.addCourse(courseCode, name); populateModel(model); return "course"; }