I have a fragment of HTML page with one form and 2 button:
Instead of an if-case you could have a switch case, should you not want to take in every option as a new request mapping.
@RequestMapping(value="/edit", method=RequestMethod.POST)
public ModelAndView edit(@ModelAttribute SomeModel model,
@RequestParam(value="action", required=true) String action) {
switch(action) {
case "save":
// do stuff
break;
case "cancel":
// do stuff
break;
case "newthing":
// do stuff
break;
default:
// do stuff
break;
}
}