You can use the paramsannotation attribute @RequestMappingto select the controller method depending on the Http parameters.
See this example:
@RequestMapping(params = "form", method = RequestMethod.GET)
public ModelAndView createForm() {
...
}
@RequestMapping(method = RequestMethod.GET)
public ModelAndView list() {
...
}
This is a REST style, for example Spring ROO uses: if the request contains a parameter forms, then a handler is used createForm, if a method is not used list.
source
share