语法:@RequestMapping(value=”user/{userId}/{userName}”)
请求路径:
http://localhost:8080/show2/6/dadoudou.do
controller层:
@RequestMapping("show2/{id}/{name}")
public ModelAndView test02(@PathVariable("id")Long id,@PathVariable("name")String name) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("hello2");
modelAndView.addObject("message","id="+id+"name="+name);
return modelAndView;
}
请求: