0

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;
    }
    
}
Umair Khan
  • 1,684
  • 18
  • 34
Bassa
  • 1
  • 1

0 Answers0