db.htmlThymeleaf मानचित्र फार्म बाइंडिंग
<div th:each="pr, stat: *{mergeMap}">
<tr>
<td><input type="text" name="key" th:value="${pr.key}" /></td>
<td><input type="text" name="value" th:value="${pr.value}" /></td>
</tr>
</div>
इस इनपुट प्रस्तुत करने पर, मैं हमेशा mergeMap स्प्रिंग नियंत्रक पर रिक्त मिलता है। मर्जमैप का मूल्य प्राप्त करने के लिए क्या किया जाना चाहिए?
Controller.java
@RequestMapping(value = "/shot")
public String saveMergeProducts(@ModelAttribute(value="prod") MergedProductInfoDTO prod, BindingResult bindingResult,
Model model, HttpServletRequest request) {
System.out.println(prod.toString());
return "forward:/backoffice/db";
}
एचटीएमएल
<form action="#" th:action="@{shot}" method="POST" th:object="${prod}">
<tr>
<td><span th:text="${index.index}"></span></td>
<td><input type="text" name="id" th:value="*{id}" th:readonly="readonly" /></td>
<td><input type="text" name="categoryName" th:value="*{categoryName}" th:readonly="readonly" /></td>
<td><input type="text" name="subCategoryName" th:value="*{subCategoryName}" th:readonly="readonly" /></td>
<td><input type="text" name="productBrand" th:value="*{productBrand}" /></td>
<td><input type="text" name="productSubBrand" th:value="*{productSubBrand}" /></td>
<td><input type="text" name="series" th:value="*{series}" /></td>
<td><input type="text" name="model" th:value="*{model}" /></td>
</tr>
<tr>
<td colspan="7">
<tr>
<th>KEY</th>
<th>VALUE</th>
</tr>
<div th:each="pr, stat: *{mergeMap}">
<tr>
<td><input type="text" name="mergeMapKey" th:value="${pr.key}" /></td>
<td><input type="text" name="mergeMapValue" th:value="${pr.value}" /></td>
</tr>
</div>
</table>
</td>
<td><input type="text" name="tags" th:value="*{tags}" /></td>
<td><input type="submit" value="Submit" /></td>
</tr>
mergeMap मूल्य thymeleaf ui में आबादी नहीं हो रही है। –
मानचित्र कुंजी के साथ prepopulated किया जाना चाहिए। इन चाबियों का उपयोग नक्शे के मानों को तदनुसार अद्यतन करने के लिए किया जाएगा। – Bnrdo
मानचित्र में दोनों कुंजी और मूल्य हैं, मैं अपने मूल्यों को भी कैसे बना सकता हूं? –