HTTP Status 500-java.lang.illegalstateexception:neither Bindingresult nor plain target object for Bean name ' Comman d ' available as request attribute error: an attribute with no command in the request field
<form:input path= "LastName"/> To display a page, you must have a Bean,bean in the domain object that corresponds to the form path.
<form:form action= "emp" method= "POST" modelattribute= "Employee" >
@RequestMapping (value = "/emp", method=requestmethod.get) public
String input (map<string,object> Map) {
map.put ("department", Departmentdao.getdepartments ());
Map.put ("Employee", new employee ());
return "input";
}
Workaround: Specify the data model principle of the binding through the Modelattribute property: If this property is not specified, the default form bean that reads command from the request domain object, that is, the default modelattribute is the command If the property value does not exist, an error occurs SPRINGMVC that the form must be echoed, even if it is the first time to request the domain to find the bean to match the current form value, even if it does not need to echo