When I submit data from Jsp to spring controller @ModelAttribute
is empty. Please help me to solve this.
@Controller
@RequestMapping("/mainCategory")
public class MainCategoryController {
@RequestMapping(value = "/test", method = RequestMethod.GET)
public ModelAndView load() {
ModelAndView modelAndView = new ModelAndView("mainCatTile","mainCategory", new MainCategory());
return modelAndView;
}
@ResponseBody
@RequestMapping(value = "/save", method = RequestMethod.POST, headers = "Accept=application/json")
public Object save(@ModelAttribute MainCategory mainCategory, ModelMap modelMap,BindingResult result) {
System.out.println("");
return null;
}
}