コード例 #1
0
  @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";
    }
  }
コード例 #2
0
 @RequestMapping(value = "/", method = RequestMethod.GET)
 public String list(Model model) {
   model.addAttribute("days", RECENT_DAYS);
   model.addAttribute("records", recordFacade.getRecordsLastDays(RECENT_DAYS));
   return "home";
 }