Exemple #1
0
 @RequestMapping(value = "/edit/{id}", method = RequestMethod.GET)
 public ModelAndView edit(@PathVariable Integer id) {
   ModelAndView mav = new ModelAndView(MODULE_EDIT);
   try {
     Module module = moduleService.get(Long.parseLong(id + ""));
     ObjectMapper mapper = JacksonMapper.getInstance();
     String json = mapper.writeValueAsString(module);
     mav.addObject("message", "success");
     mav.addObject("module", json);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return mav;
 }
Exemple #2
0
  @RequestMapping(value = "/add", method = RequestMethod.GET)
  public ModelAndView add() {

    ModelAndView mav = new ModelAndView(MODULE_EDIT);
    Module module = new Module();
    try {
      ObjectMapper mapper = JacksonMapper.getInstance();
      String json = mapper.writeValueAsString(module);
      mav.addObject("message", "success");
      mav.addObject("module", json);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return mav;
  }