Here i am submitting the form using submit action. In Controller the model object is showing null value. Suppose i am using request.getParameter("mcodeName") - then i am getting value. Whey value is null when i using getMcode() method. Please help me to resolve this issue.
@RequestMapping(value="/masterCode.do", method=RequestMethod.POST) public ModelAndView addMasterCode(HttpServletRequest req, HttpServletResponse res, @ModelAttribute("masterCodeBean") MasterCodeBean mCodeBeanObj) { log.info(""); String mCodeName = mCodeBeanObj.getMaster_code_name(); //getting null String mCodeStatus = mCodeBeanObj.isActive(); //getting null System.out.println("Req code des " + req.getParameter("mCodeName")); System.out.println("Req active : " + req.getParameter("active")); ModelAndView model = null; try { model = new ModelAndView("masterCode"); codeDelegate.addMasterCodeDetails(mCodeBeanObj); model.addObject("masterCodeBean", mCodeBeanObj); }catch(Exception e) { System.out.println(EXCEP_ERR); } return model; }
my form bind model attribute like