Question

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>
Was it helpful?

Solution

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.

OTHER TIPS

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" >
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top