@RequestMapping(value = "/search", method = RequestMethod.GET) public String getSearch(Model model) { List<Blog> list = new ArrayList<Blog>(); list = blogService.findAll(); model.addAttribute("blog", new Blog()); model.addAttribute("blogs", list); return PAGE_BLOGS; }
@RequestMapping(value = "/add", method = RequestMethod.POST) public String postAdd(@ModelAttribute("user") Blog blog) { blogService.save(blog); return "redirect:/blog/search"; }