1. usl格式: http://localhost:8080/contact/delete/3
java代码
@RequestMapping(value="/delete/{id}")public Map<String,Object> delete(@PathVariable("id") Integer id){boolean result = contactService.deleteContactById(id);
也可以这样
@RequestMapping(value="/delete/{id}")public Map<String,Object> delete(@ModelAttribute("id") Integer id){
2.url格式:http://localhost:8080/contact/delete?id=3
java代码
@RequestMapping(value="/delete")public Map<String,Object> delete(@RequestParam("id") Integer id){boolean result = contactService.deleteContactById(id);
也可以这样
@RequestMapping(value="/delete")public Map<String,Object> delete(@ModelAttribute("id") Integer id){