Spring Framework offers to handle URI method parameters by using @PathVariable annotation
@Controller
@RequestMapping("admin")
public class PathVarController {
@RequestMapping("/welcome/{springPathVariable}/{page}")
public ModelAndView pathVariableTest(@PathVariable("page") String name, @PathVariable("springPathVariable") String pathVariable ) {
ModelAndView mav = new ModelAndView("pathVariable");
mav.addObject("message", " "+ name+" Your PathVariable is : "+pathVariable);
return mav;
}
}