@RequestMapping(method = RequestMethod.POST) public String processForm( ModelMap modelmap, @ModelAttribute(value = "addBooking") Booking booking, BindingResult result) { // list data try { // add data bookingService.save(booking); modelmap.addAttribute("addBooking", new Booking()); List<Booking> bookingList = bookingService.list(); modelmap.addAttribute("retSampleList", bookingList); modelmap.addAttribute("retSamples", "---"); } catch (SequenceException e) { // System.out.println(e.getErrMsg()); modelmap.addAttribute("retSamples", e.getErrMsg()); } finally { } return "booking"; }
@RequestMapping( value = {"", "/list"}, method = RequestMethod.GET) public String defaultPage(ModelMap modelmap) { // add modelmap.addAttribute("addBooking", booking); try { List<Booking> bookingList = bookingService.list(); modelmap.addAttribute("retSampleList", bookingList); modelmap.addAttribute("retSamples", "---"); } catch (SequenceException e) { // System.out.println(e.getErrMsg()); modelmap.addAttribute("retSamples", e.getErrMsg()); } finally { } return "booking"; }