【问题标题】:Spring form tag throws error in jsp pageSpring表单标签在jsp页面中抛出错误
【发布时间】:2012-09-20 20:29:02
【问题描述】:

我是 spring mvc 的新手,并且努力使用 spring 表单标签来实现表单。在没有什么帮助的情况下,我从 here 获得了 spring tag lib

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

    <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>

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

语法错误:缺失;在语句错误 500 之前: java.lang.IllegalStateException:既不是 BindingResult 也不是普通的 bean 名称“命令”的目标对象可作为请求提供 属性。

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

【问题讨论】:

    标签: java spring spring-mvc


    【解决方案1】:

    试试下面

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

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

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 2014-06-21
      • 2017-09-18
      • 2013-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-04
      相关资源
      最近更新 更多