Exemplo n.º 1
0
 @RequestMapping(value = "/save", method = RequestMethod.POST)
 public String handleSave(Demo demo, Model model) {
   logger.info("==========handleSave==============");
   demoService.save(demo);
   model.addAttribute("demo", demo);
   model.addAttribute("id", demo.getId());
   return "demo";
 }
Exemplo n.º 2
0
 @RequestMapping(
     value = "/xml/write/{id}/{name}.do",
     produces = {MediaType.APPLICATION_XML_VALUE + ";charset=UTF-8"})
 @ResponseBody
 @ResponseStatus(HttpStatus.OK)
 public Demo handleWriteXMLDo(
     @PathVariable("id") Long id, @PathVariable("name") String name, Model model) {
   logger.info("handleWriteXMLDo  id==" + id);
   Demo demo = demoService.getByName(id, name);
   demoService.save(demo); // 捕获异常
   return demo;
 }