Reputation: 9095
Supose I have a controller like this in a Spring project:
@Controller
@RequestMapping(value="mapping_one")
public class AcessoController {
@RequestMapping(value="mapping_two")
public ModelAndView mapping_two() {
ModelAndView mav = new ModelAndView();
mav.setViewName("view");
return mav;
}
}
and supose too the url informed by user is something like that:
http://webapp/mapping_one/mapping_two/some_string_here/
Is there any way to capture this some_string_here
inside the method mapping_two
from controller above (the type of returned value can be different)?
Upvotes: 1
Views: 486
Reputation: 48837
You could probably use the @PathVariable annotation:
@RequestMapping(value = "mapping_two/{theString}")
public ModelAndView mappingTwo(@PathVariable String theString) {
...
}
Upvotes: 2