在@PathVariable后加入参数id即可,如下:
@Controller
public class ResfulController {
@RequestMapping("/resful/{a}/{b}")
public String addab(@PathVariable("a") int a, @PathVariable("b") int b, Model model){
int res = a + b;
model.addAttribute("msg",res);
return "hello111111";
}
}