i\'m having a problem with Thymeleaf and Spring MVC.
I\'m following a tutorial from spring.io website http://spring.io/guides/gs/handling-form-submission/ and when I
This is the expected behavior. You have the model
in the response
while getting to your greetings view
, but as long as that http
request/response
is done, it doesn't exist anymore. You will hold the values in the <form>
tag and you will need to provide these values upon form
submit
.
Meaning, that if you want to send these values back you will need to add 2 hidden input
s to hold these two values.
<form action="#" th:action="@{/greeting}" th:object="${greeting}" method="post">
<p>Id: <input type="text" th:field="*{id}" /></p>
<p>Message: <input type="text" th:field="*{content}" /></p>
<input type="hidden" th:field="*{hour}" />
<input type="hidden" th:field="*{longNumber}" />
<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>