如何通过< display:table>传递超链接值<显示:柱>标签 [英] How to pass hyper link value via <display:table> <display:column> tag
问题描述
通过Iterator,我能够在我的动作类中传递超链接值,用于更新和删除,但 href
在 display:table
display:column
tag。如何通过显示表中的超链接传递值,以及如何放置图像?
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?
工作迭代器代码:
<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>
推荐答案
你需要在 display:table
中添加两列用于编辑,另一列用于删除URL。还要添加 uid =row
该标签的属性。
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>
这里有一个完整的例子: Struts 2中的分页使用显示标签。
A complete example you can find here: Pagination in Struts 2 Using display tag.
这篇关于如何通过< display:table>传递超链接值<显示:柱>标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!