示例#1
0
 @RequestMapping(value = "/cars/delete", method = RequestMethod.POST)
 public String delete(int carId) {
   carDao.delete(carId);
   return "redirect:/cars";
 }
示例#2
0
 @RequestMapping(value = "/cars/{id}", method = RequestMethod.POST)
 public String update(Car car, @PathVariable int id) {
   carDao.update(id, car); // car.id already set by binding
   return "redirect:/cars";
 }
示例#3
0
 @RequestMapping(value = "/cars", method = RequestMethod.POST)
 public String add(Car car) {
   carDao.add(car);
   return "redirect:/cars";
 }
示例#4
0
 @RequestMapping(value = "/cars/{id}", method = RequestMethod.GET)
 public String get(@PathVariable int id, Model model) {
   model.addAttribute("car", carDao.get(id));
   return "carDetail";
 }
示例#5
0
 @RequestMapping(value = "/cars", method = RequestMethod.GET)
 public String getAll(Model model) {
   model.addAttribute("cars", carDao.getAll());
   return "carList";
 }