春のnull ModelAttributeのもう1つですが、見つけたものはすべて試しましたが、うまくいきません。
このチュートリアル機能を Web アプリspring-mvcに追加しました。フォームから Bean にデータを戻す必要がある場合を除いて、すべてがうまく機能します。
私は2つの投稿方法を使用します
@RequestMapping(method = RequestMethod.POST)
public String openEdit(@RequestParam("notfound") String[] notFound,
Model model){
EditForm editForm = editModel.createEditForm(notFound);
model.addAttribute("editForm",editForm);
return "Edit/EditOwners";
}
@RequestMapping(method = RequestMethod.POST,value = "/saveOwners")
public String saveOwners(@ModelAttribute("editForm") EditForm editForm){
editModel.addOwners(editForm);
return "index";
}
最初のものは正常に動作し、Jsp でデータを確認できます。2 番目のものは新しい ModelAttribute を取得します。
これが私のフォームです
<form:form method="POST" action="saveOwners" modelAttribute="editForm" >
<table class="table table-bordered table-striped table-hover table-condensed">
<caption>
<h4>Edit The Owners</h4>
</caption>
<thead>
<tr>
<td>Name</td>
</tr>
</thead>
<tbody>
<c:forEach items="${editForm.owners}" var="item" varStatus="status">
<tr>
<td>${item.name}</td>
<td><input type="text" name="${owners[status.index].outId}" value="${item.outId}" /> </td>
<td><input type="text" name="${owners[status.index].type}" value="${item.type}" /> </td>
</tr>
</c:forEach>
</tbody>
</table>
<input type="submit" value="Save" class="btn btn-primary"/>
</form:form>
ここで何が間違っているようですか?PS私はタイプ属性の有無にかかわらず入力を試みましたが、それでもnullになりました。私が言ったように、データを見ることはできますが、送信できません。