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

xiaoxiao2021-02-28  93

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 找不到对应的绑定对象了

转载请注明原文地址: https://www.6miu.com/read-34728.html

最新回复(0)