|
|
|
@ -30,6 +30,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Rob Winch
|
|
|
|
|
* @author Doo-Hwan Kwak
|
|
|
|
|
*/
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping("/")
|
|
|
|
@ -73,4 +74,16 @@ public class MessageController {
|
|
|
|
|
throw new RuntimeException("Expected exception in controller");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "delete/{id}")
|
|
|
|
|
public ModelAndView delete(@PathVariable("id") Long id) {
|
|
|
|
|
this.messageRepository.deleteMessage(id);
|
|
|
|
|
Iterable<Message> messages = this.messageRepository.findAll();
|
|
|
|
|
return new ModelAndView("messages/list", "messages", messages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "modify/{id}", method = RequestMethod.GET)
|
|
|
|
|
public ModelAndView modifyForm(@PathVariable("id") Message message) {
|
|
|
|
|
return new ModelAndView("messages/form", "message", message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|