Wednesday, June 20, 2012

Spring MVC:Handling multiple submit buttons in a single form

Specify the parameter name in the name attribute. 


<input type = "submit" name = "update" value = "Update" />
<input type = "submit" name = "delete" value = "Delete" />

Include the "params" attribute, with the corresponding parameter name as value, in the annotation for request mapping



@RequestMapping(..., params = "update")
public ModelAndView updateCustomer(...) { ... }

@RequestMapping(..., params = "delete")
public ModelAndView deleteCustomer(...) { ... }


1 comment:

Anonymous said...

Thank you Rocky. Good info.