@RequestMapping(value = "/{days}", method = RequestMethod.GET) public String list(@PathVariable String days, Model model) { try { int intDays = Integer.parseInt(days); model.addAttribute("days", intDays); model.addAttribute("records", recordFacade.getRecordsLastDays(intDays)); return "home"; } catch (NumberFormatException ne) { model.addAttribute("error", true); model.addAttribute("days", RECENT_DAYS); model.addAttribute("records", recordFacade.getRecordsLastDays(RECENT_DAYS)); return "home"; } }
@RequestMapping(value = "/", method = RequestMethod.GET) public String list(Model model) { model.addAttribute("days", RECENT_DAYS); model.addAttribute("records", recordFacade.getRecordsLastDays(RECENT_DAYS)); return "home"; }