首页 > 代码库 > springmvc 错误:Neither BindingResult nor plain target object for bean name 'command' available as request attribute

springmvc 错误:Neither BindingResult nor plain target object for bean name 'command' available as request attribute

原因:springmvc默认页面回显,必须在页面的请求域里面添加对应的bean 默认的bean name为command

 

解决:

在handler里面添加一个对应的bean

map.put("employee", new Employee());

在页面上使用

<form:form action="emp" method="POST" modelAttribute="employee">

 

springmvc 错误:Neither BindingResult nor plain target object for bean name 'command' available as request attribute