Tuesday, 22 March 2016

How to call Get & Put methods using the same request mapping in Spring MVC



@Controller
@RequestMapping(value = "/show-view-and-update")
public class TravelDetailsUpdateController {

 @RequestMapping(method = RequestMethod.GET)
 public String showView(Model m,HttpServletRequest request) {
  return "show-travel-details"
 }
 @RequestMapping( method = RequestMethod.PUT)
 public ModelAndView updateTravelDetails(@Valid TravelDetailsUpdateVO travelDetailsUpdateVO){
  return new ModelAndView("show-travel-details");
 }

}

No comments:

Post a Comment