@RequestMapping(value = "/car/save", method = RequestMethod.POST) public View createCar(@ModelAttribute Car car, ModelMap model) { if (StringUtils.hasText(car.getId())) { carService.updateCar(car); } else { carService.addCar(car); } return new RedirectView("/SpringMongod/car"); }
@RequestMapping(value = "/car/delete", method = RequestMethod.GET) public View deleteCar(@ModelAttribute Car car, ModelMap model) { carService.deleteCar(car); return new RedirectView("/SpringMongod/car"); }
@RequestMapping(value = "/car", method = RequestMethod.GET) public String getCarList(ModelMap model) { model.addAttribute("carList", carService.listCar()); return "result"; }