if I have the following controller, how do you handle multiple buttons on the same page that do a post? For example, I might might add an additional post method to AddOwnerForm - but I am not sure how spring would differentiate between the various post methods. The only thing I can think of is change the RequestMapping to /addOwner/* and change the post url in javascript when a button is clicked.
@Controller
@RequestMapping("/addOwner.do")
@SessionAttributes(types = Owner.class)
public class AddOwnerForm {
@RequestMapping(method = RequestMethod.GET)
public String setupForm(Model model) { ... }
@RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute Owner owner, BindingResult result, SessionStatus status) { ... }
}


Reply With Quote