我刚刚在使用spring mvc更新窗体时出现了一个小问题。使用Spring MVC更新模型属性问题
以下是在提交POST方法的形式,游戏价值越来越更新后,我的代码片断
<form:form name="personInfo" method="post" modelAttribute="person">
<td class="empty"></td>
<td class="editablefields">Football:</td>
<td class="value">
<c:forEach items="${person.gameList}" var="game" varStatus = "count">
<c:if test="${game.code == 'FB'}">
<form:textarea path="gameList[${count.index }].value" id="" />
</c:if>
</c:forEach>
</td>
</form:form>
,但game.code即将为空。
请解释为什么会发生这种情况?
你不会在表单中引用'game.code'作为表单输入。如果你想检索后处理程序中的值,添加'gameList [$ {count.index}]。code'作为一个隐藏的输入字段 –
这是没有必要的。我做了类似的事情之后,它得到了正确的更新。在这种情况下,我错过了一些不能找到的东西 –