【发布时间】:2018-05-23 17:02:51
【问题描述】:
我将对象myObject 发送给查看,其中一个值使用post 方法放在form 内的input 中。如何设置要查看的值,然后通过提交此表单(但使用另一种对象类型)来获取它?
我尝试了类似的方法:
<form action="#" th:action="@{/myMethod}" th:object="${anotherObject}" method="post" xmlns="http://www.w3.org/1999/html">
<input style="display:none" type="text" th:name="*{fieldFromAnotherObject}" th:value="${sendedObject.fieldFromSendedObject}"/>
(值正确)。然后我的后端中有null 作为fieldFromAnotherObject 字段anotherObject。
【问题讨论】:
标签: java spring spring-mvc spring-boot thymeleaf