Example #1
0
 // Fetch snippet by id
 @RequestMapping("/snippet")
 public String getSnippetById(Model model, @RequestParam("id") String snippetId) {
   Snippet snippet = snippetService.getSnippetById(snippetId);
   model.addAttribute("snippet", snippet);
   return "snippet";
 }
Example #2
0
 @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
 public String deleteSnippetAction(Model model, @PathVariable("id") String snippetId) {
   Snippet snippet = snippetService.getSnippetById(snippetId);
   snippetService.deleteSnippet(snippet);
   return "redirect:/snippets/";
 }