コード例 #1
0
  @RequestMapping("/delete/{id}")
  public String edit(@PathVariable Integer id) {

    customerService.deleteById(id);

    return "redirect:/customer/list";
  }
コード例 #2
0
  @RequestMapping(method = RequestMethod.POST)
  public String saveOrUpdateProduct(Customer customer) {

    Customer savedCustomer = customerService.saveOrUpdate(customer);

    return "redirect:/customer/show/" + savedCustomer.getId();
  }
コード例 #3
0
  @RequestMapping("/show/{id}")
  public String getProduct(@PathVariable Integer id, Model model) {

    model.addAttribute("customer", customerService.getById(id));

    return "customer/show";
  }
コード例 #4
0
  @RequestMapping("/edit/{id}")
  public String edit(@PathVariable Integer id, Model model) {

    model.addAttribute("customer", customerService.getById(id));

    return "customer/customerform";
  }
コード例 #5
0
  @RequestMapping({"/list", "/"})
  public String listCustomers(Model model) {

    model.addAttribute("customers", customerService.listAll());

    return "customer/list";
  }