1

Via Iterator I was able to pass hyper link value in my action class where it was used to update and delete, but href is not working inside display:table display:column tag. How to pass value via hyperlink in display table, and also how to put image?

Working Iterator Code :

<s:iterator value=" #request.hrlist" >

<td><s:property value="Employement_detail"/></td>
<td><s:property value="Leaves_details"/></td>
<td><a href="editHyper?value=<s:property value="Employee_id"/>"><img src="img/edit.png" height="18" width="18" "></a></td>
<td><a href="delete?value=<s:property value="Employee_id"/>"><img src="img/delete.png" height="18" width="18" onclick="return myFunction()"></a></td>

</s:iterator>
Roman C
  • 49,761
  • 33
  • 66
  • 176
Akash kumar
  • 981
  • 3
  • 14
  • 27

2 Answers2

0

I found it

<display:column property="employeeId" title="Update" href="editHyper" paramId="value" paramProperty="employeeId" />

<display:column property="employeeId" title="Delete" href="delete" paramId="value" paramProperty="employeeId" >
Akash kumar
  • 981
  • 3
  • 14
  • 27
0

You need to add two columns to the display:table one for the edit and another for the delete URLs. Also add uid="row" attribute to the tag.

<s:url var="editUrl" action="editHyper">
  <s:param name="Employee_id" value="%{#attr.row.Employee_id}" />
</s:url>

<s:url var="deleteUrl" action="delete">
  <s:param name="Employee_id" value="%{#attr.row.Employee_id}" />
</s:url>

<display:column title="Edit">
  <s:a href="%{#editUrl}">Edit</s:a>
</display:column>

<display:column title="Delete">
  <s:a href="%{#deleteUrl}">Delete</s:a>
</display:column> 

A complete example you can find here: Pagination in Struts 2 Using display tag.

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • will it be same way for adding js and image, the core code is pasted under second post of "I found that" heading, but that is different way i did this, please suggest me that your works for calling js and attaching image. – Akash kumar May 01 '14 at 09:40
  • 1
    Just add ` – Roman C May 01 '14 at 09:51
  • you should also upvote the answer that helped you and helped a lot of people. – Roman C Jan 16 '18 at 01:39