【发布时间】:2022-01-22 13:31:07
【问题描述】:
对于每道菜,我都有一个输入来指定菜的数量,但是如何将其转换为 DTO 的 DishQuantityMap?其中 firstInteger - discId,second - 订购的菜肴数量。
<form action="#" th:action="@{/greeting}" th:object="${Order}" method="post">
<span th:each="dish : ${dishList}">
<input id="number" type="number" value="42">
</span>
</form>
我知道我的代码中缺少 th:field,那是因为我不知道如何正确实现它。
public class Order {
private String userName;
Map<Integer, Integer> DishQuantityMap;
}
【问题讨论】:
标签: java spring spring-boot spring-mvc thymeleaf