开发者

Spring MVC Table selected row

开发者 https://www.devze.com 2022-12-29 00:36 出处:网络
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 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}" />
0

精彩评论

暂无评论...
验证码 换一张
取 消