I want to send a string from an HTML form to a Spring Boot controller but I would like this string not to be visible to the client. I would like to use the hidden field but something is not working and I don't understand where I'm wrong. In the code you will find all my proofs.
<form th:action="@{/test-server-asincrono}" th:object="${InterrompiAsincrono}" method="POST">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}">
<!--/*<input type="hidden" th:field="*{interrompi}" id="interrompi" th:value="si">*/-->
<!--/*<input type="hidden" th:field="*{interrompi}" id="interrompi" value="${'si'}">*/-->
<!--/*<input type="hidden" th:field="*{interrompi}" id="interrompi" value="si">*/-->
<!--/*<input type="hidden" th:name="*{interrompi}" id="interrompi" value="si">*/-->
<select th:field="*{interrompi}" >
<option th:value="si">Si</option>
</select>
<input type="submit" value="Interrompi il test" >
</form>
CodePudding user response:
<input type="hidden" name="interrompi" value="si">