コード例 #1
0
 @RequestMapping("deleteLevelYear")
 public String deleteForm(@RequestParam("id") Integer id, Map<String, Object> map) {
   LevelAcademicYear levelAcademicYearResult = new LevelAcademicYear();
   academicYearService.delete(id);
   levelAcademicYearResult = new LevelAcademicYear();
   map.put("levelYearview", levelAcademicYearResult);
   map.put("levelacademicyearList", academicYearService.getAllYear());
   return "redirect:levelyear";
 }
コード例 #2
0
 @RequestMapping(value = "/updatelevelyear", method = RequestMethod.GET)
 public ModelAndView edit(@RequestParam("id") Integer id) {
   ModelAndView mav = new ModelAndView("levelYearviewEdit");
   LevelAcademicYear levelAcademicYear = academicYearService.getYear(id);
   mav.addObject("levelYearviewEdit", levelAcademicYear);
   return mav;
 }
コード例 #3
0
 @RequestMapping({"/levelyear", "/levelyears"})
 public String setupForm(Map<String, Object> map) {
   LevelAcademicYear levelAcademicYear = new LevelAcademicYear();
   map.put("levelacademicyear", levelAcademicYear);
   map.put("levelacademicyearList", academicYearService.getAllYear());
   return "levelYearview";
 }
コード例 #4
0
 @RequestMapping(value = "/updatelevelyear", method = RequestMethod.POST)
 public String update(
     @ModelAttribute("levelYearviewEdit") LevelAcademicYear levelAcademicYear,
     BindingResult result,
     SessionStatus status) {
   // System.out.println("Hasil dari kontroller: "+student.getStudentDetail().getDateBirth());
   academicYearService.edit(levelAcademicYear);
   status.setComplete();
   return "redirect:levelyear";
 }
コード例 #5
0
 @RequestMapping(value = "/levelyear.do", method = RequestMethod.POST)
 public String doActions(
     @ModelAttribute LevelAcademicYear levelAcademicYear,
     BindingResult result,
     @RequestParam String action,
     Map<String, Object> map,
     SessionStatus status,
     ModelMap model) {
   LevelAcademicYear levelAcademicYearResult = new LevelAcademicYear();
   switch (action.toLowerCase()) { // only in Java7 you can put String in switch
     case "add":
       academicYearService.add(levelAcademicYear);
       status.setComplete();
       levelAcademicYearResult = levelAcademicYear;
       model.addAttribute("levelacademicyear", new LevelAcademicYear());
       break;
     case "tambah":
       academicYearService.add(levelAcademicYear);
       status.setComplete();
       levelAcademicYearResult = levelAcademicYear;
       model.addAttribute("levelacademicyear", new LevelAcademicYear());
       break;
     case "search":
       LevelAcademicYear searchedlevelAcademicYear =
           academicYearService.getYear(levelAcademicYear.getId());
       levelAcademicYearResult =
           searchedlevelAcademicYear != null ? searchedlevelAcademicYear : new LevelAcademicYear();
       break;
     case "back":
       model.addAttribute("levelacademicyear", new LevelAcademicYear());
       break;
   }
   map.put("levelYearview", levelAcademicYearResult);
   map.put("levelacademicyearList", academicYearService.getAllYear());
   return "levelYearview";
 }