java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'category' available as request attribute

后端 未结 3 2027
醉梦人生
醉梦人生 2020-12-10 07:28

I looked almost all answers related this problem on the web but could not figure out the problem in my code.

Here is my JSP page.



        
3条回答
  •  误落风尘
    2020-12-10 08:02

    This works for me!

    Name
    Age

    Controller

    @RequestMapping(value = "/employee", method = RequestMethod.POST)
        private ModelAndView addemployee(Employee emp, ModelAndView model, 
                @RequestParam String name, 
                @RequestParam String age) {
    
            emp.setAge(age);
            emp.setName(name);
            employeeService.persistEmployee(emp);
    
            return new ModelAndView("redirect:/employee.do");
    
        }
    

提交回复
热议问题