@RequestMapping(value = "/processform", method = RequestMethod.POST)
public String handleForm(@ModelAttribute User user, Model m){
return "contactSucess";
}
// it works three works
// replace @RequestParam
// do not have use Model
// do not need to create model of user and set it in model.setAttribute("user", user)
// it can be use on top of method
@ModelAttribute
public void commonDataForModel(Model m) {
m.addAttribute("Header", "0BIT1NP");
m.addAttribute("Desc", "Paving Digital path of Nepal");
}
// this commonDataForModel will execute before other method
// Set the value for attribute for all methods
Comments
Post a Comment