Spring MVC Table selected row
in a Spring MVC 2.5 application i'm using a spring <form:form>
component and in this form a table with c:forEach
is rendered.
In each row a submit button is placed in. If i start a submit by clicking a button i would like to knwo, which button has processed the submit.
<form:form commandName="formObject">
<table class="data-table" cellpadding="1" cellspacing="1" border="0">
<thead>
<tr>
</tr>
</thead>
<c:forEach items="${list}" var="document" varStatus="row">
开发者_JAVA技巧 <tr>
<td>
<input type="submit" value="${document.title}"/>
<td>
</tr>
</c:forEach>
</table>
</form:form>
THX.
Give the submit button a name. You can handle the request parameter from that button like any other parameter. Some browser might handle the value they give differently though.
<input name="submittype" type="submit" value="${document.title}" />
精彩评论