views:

165

answers:

1

Hi,

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">
    <tr>
      <td>  
        <input type="submit"  value="${document.title}"/>
      <td>
    </tr>
  </c:forEach>
</table>
</form:form>

THX.

+1  A: 

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}" />
Daff
It ain't nice, but it works.
ich-bin-drin
Still nicer than having JavaScript hacks (which is usually the proposed way)
Daff