0

我是 spring mvc 的新手,并且很努力地使用 spring 表单标签来实现表单。在没有什么帮助的情况下,我得到了从这里工作的弹簧标签库

我现在遇到的问题有点奇怪,我不明白。

    <form:form>
     <table id="<portlet:namespace />AddEquipmentTable" cellpadding="3">
      <tr><td colspan="2"><label class="required">
           <fmt:message key="requiredFieldsTxt" /></label></td>
      </tr>
      <tr><td><%-- <form:label path="assetIdLabel"> --%><fmt:message key="assetIdTxt" /><%-- </form:label> --%></td>
          <td><input type="text" id="assetId" name="assetId" size="30" /></td>
          <td>&nbsp;</td>
       </tr> 
        .......
        .........

     </table>
   </form:form>

我已经评论了标签,因为当我取消评论时它在萤火虫中显示错误

语法错误:缺少;before 语句错误 500:java.lang.IllegalStateException:Bean 名称“命令”的 BindingResult 和普通目标对象都不能用作请求属性。

谁能帮我这个。我是新手,我还在尝试了解 spring mvc 的工作原理

4

2 回答 2

0

采用

<form:form method="POST" commandName="customerForm">

http://www.mkyong.com/spring-mvc/spring-mvc-neither-bindingresult-nor-plain-target-object-for-bean-name-xxx-available-as-request-attribute/

于 2012-09-20T21:01:43.280 回答
0

试试下面

<form:form method="POST" modelAttribute="command">
</form:form>

command 是必须添加到 modelandview 的对象。

于 2012-09-21T05:58:13.347 回答