I wanted to use Spring MVC hidden tag in below code. Is this possible in below code, what I have to write in my controller to do that or what I am doing is correct.
<c:forEach var="record" items="${records}">
<tr>
<td>
<form:form id="myForm" action="list.html" method="post">
<input type="hidden" name="record" value="${record}" />
<a href="#" onclick="document.getElementById('myForm').submit();">Submit</a>
</form:form>
</td>
</tr>
</c:forEach>
Any help will be highly appriciated.
You are on the right track [depending on what your backing bean is], but in order to bind an ID as a hidden field on submission automatically to a “Person” bean (in this example), you would do something like:
In case you’d like to render a hidden field, you would use a
form:hiddentag:Take a look at Hidden Input Tag section of the Spring docs.