Neither BindingResult nor plain target object for bean name 'command' availa

Spring给我们提供了一个commandName属性,我们可以通过该属性来指定我们将使用Model中的哪个属性作为form需要绑定的command对象。

<form:form id="inputForm"  commandName="matUse"  action="${ctx}/mat/matUse/save" method="post" class="form-horizontal">
除了commandName属性外,指定modelAttribute属性也可以达到相同的效果。
<form:form id="inputForm"  modelAttribute="matUse" action="${ctx}/mat/matUse/save" method="post" class="form-horizontal">
报这个错误的原因是 在全局替换 bean字段 model 为module 的时候把 modelAttribute 替换成了 moduleAttribute 。导致Spring mvc 找不到对应的绑定对象了
 
 

发布了46 篇原创文章 · 获赞 15 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/LSSSSSS/article/details/72896582