Ejemplo n.º 1
0
 @RequestMapping(method = RequestMethod.POST)
 public String registerNewMember(
     @Valid @ModelAttribute("newMember") Member newMember, BindingResult result, Model model) {
   if (!result.hasErrors()) {
     memberDao.register(newMember);
     return "redirect:/";
   } else {
     model.addAttribute("members", memberDao.findAllOrderedByName());
     return "index";
   }
 }
Ejemplo n.º 2
0
 @RequestMapping(method = RequestMethod.GET)
 public String displaySortedMembers(Model model) {
   model.addAttribute("newMember", new Member());
   model.addAttribute("members", memberDao.findAllOrderedByName());
   return "index";
 }