title: Get row Id from a display tag table on a jsp, into a struts 2 action class
body: <p>I am using display tag to display data in a table on a JSP. Now I want to give two links for each row, one for editing &amp; one for deleting the row.</p>
  
  <p>There are some posts on stackoverflow regarding the same([question]: <a href="https://stackoverflow.com/questions/3454288/how-to-use-multiple-buttons-one-on-each-line-for-jsp-page-using-struts2/3458807#3458807">How to use multiple buttons (one on each line) for JSP page using Struts2</a> , [question]: <a href="https://stackoverflow.com/questions/3480980/get-value-from-a-row-in-a-jsp-page-using-display-tag">Get value from a row in a JSP page using display tag</a> , [question]: <a href="https://stackoverflow.com/q/3514256">Retrieving Value from Row in Struts2 Table While using Displaytag</a>), but I could not find a solution that works for me.</p>
  
  <p>And google gave me ( <a href="http://demo.displaytag.org/displaytag-examples-1.2/example-decorator-link.jsp" rel="nofollow noreferrer">http://demo.displaytag.org/displaytag-examples-1.2/example-decorator-link.jsp</a> ), but it uses URL rewriting which I don't want to use and moreover demonstrates use with struts(I am using struts 2).</p>
  
  <p>My jsp structure and what I am currently trying is :</p>
  
  <pre><code>&lt;s:url id="editReport" action="editReport" /&gt;
  &lt;sd:div href="%{editReport}" listenTopics="editReport" formId="actionForm" showLoadingText="false" preload="false"&gt;
      &lt;s:url id="updLists" action="updLists" /&gt;
      &lt;sd:div href="%{updLists}" listenTopics="updLists" formId="enterDayReport" showLoadingText="false" preload="false"&gt;
          &lt;s:form id="enterDayReport" action="enterDayReport"&gt;
              &lt;sd:autocompleter  label="Customer " name="customer" list="customerList"  valueNotifyTopics="updLists" autoComplete="false" searchType="substring"/&gt;
              &lt;sd:autocompleter  label="Contact "  name="contact"  list="contactList"   valueNotifyTopics="updLists" autoComplete="false" searchType="substring"/&gt;
              &lt;s:select          label="Stage "    name="stage"    list="stageList"     headerKey="0" headerValue="Select" /&gt;
              &lt;s:select          label="Type "     name="type"     list="typeList"      headerKey="0" headerValue="Select" /&gt;
              &lt;sd:datetimepicker label="Date"      name="date"     formatLength="small" displayFormat="dd - MMM - yyyy"/&gt;
              &lt;s:textarea        label="Summary"   name="summary"  cols="40" rows="10"/&gt;
              &lt;s:submit          value="Save Report"/&gt;
          &lt;/s:form&gt;
      &lt;/sd:div&gt;
  &lt;/sd:div&gt;
  
  &lt;s:url id="deleteReport" action="deleteReport" /&gt;
  &lt;sd:div href="%{deleteReport}" listenTopics="deleteReport" formId="actionForm" showLoadingText="false" preload="false"&gt;
      &lt;disp:table name="dayReportsList" export="true" class="dataTable"&gt;
          &lt;disp:column property="contactCode" title="Contact"/&gt;
          &lt;disp:column property="customerCode" title="Customer"/&gt;
          &lt;disp:column property="stage" title="Stage"/&gt;
          &lt;disp:column property="type" title="Type"/&gt;
          &lt;disp:column property="summary" title="Summary"/&gt;
          &lt;disp:column property="reportDate" title="Date" format="{0,date,dd-MMM-yyyy}" /&gt;
          &lt;disp:column property="rowId" href="%{editReport}" paramId="rowID" paramProperty="rowId" title="Action"&gt;
              &lt;s:form id="actionForm" name="actionForm"&gt;
                  &lt;s:hidden id="rowId" name="rowId" value="%{rowId}"/&gt;  // This is not getting populated.
                  &lt;s:a onclick="dojo.event.topic.publish('editReport')"&gt;Edit&lt;s:property value="rowId"/&gt;&lt;/s:a&gt;&lt;br&gt;
                  &lt;s:a onclick="dojo.event.topic.publish('deleteReport')"&gt;Delete&lt;/s:a&gt;
              &lt;/s:form&gt;
          &lt;/disp:column&gt;
      &lt;/disp:table&gt;
  &lt;/sd:div&gt;
  </code></pre>
  
  <p>Here the only problem I am facing is that the <code>hidden</code> field in the display tag table is not getting populated with the "rowId" value which is a part of "dayReportsList".</p>
  
  <p>The idea here is that if a user clicks on edit, the data for the row gets populated in the form for editing. And if the user clicks delete, the row gets deleted from the database and the display table gets updated on JSP.</p>
  
  <p>Please advise.</p>
  
  <p>Thanks!!</p>