예제 #1
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;
 }
예제 #2
0
 @RequestMapping("/findall")
 public String handleList(Model model) {
   logger.info("demo02  handleList");
   List<Demo> list = demoService.findAll();
   model.addAttribute("results", list);
   return "demo";
 }
예제 #3
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";
 }
예제 #4
0
 @RequestMapping(
     value = "/json/write/{id}.json",
     produces = {MediaType.APPLICATION_JSON_VALUE + ";charset=UTF-8"})
 @ResponseBody
 @ResponseStatus(HttpStatus.OK)
 public Demo handleWriteJSON(@PathVariable("id") Long id, Model model) {
   logger.info("handleWriteJSON  id==" + id);
   Demo demo = demoService.getById(id);
   return demo;
 }
예제 #5
0
  @RequestMapping(
      value = "/xml/write/{id}.xml",
      produces = {MediaType.APPLICATION_XML_VALUE + ";charset=UTF-8"})
  @ResponseBody
  @ResponseStatus(HttpStatus.OK)
  public Demo handleWriteXML(@PathVariable("id") Long id, Model model) {
    logger.info("handleWriteXML  id==" + id);
    Demo demo = demoService.getById(id);

    // @DeclareParents
    DemoDeclareParentsService declareParents = (DemoDeclareParentsService) demoService;
    logger.info("@DeclareParents===" + declareParents.printString("@DeclareParents is ok"));

    return demo;
  }
예제 #6
0
 @RequestMapping("/flashcache")
 public void handleFlashCache() {
   logger.info("==========handleFlashCache==============");
   demoService.delete(new Demo());
 }