如何将超链接值传递给<display:table> <display:column> tag </display:column> </display:table>

时间:2014-05-01 08:00:55

标签: java jsp struts2 displaytag ognl

通过Iterator,我能够在我的操作类中传递超链接值,用于更新和删除,但href display:table display:column内部<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> 无效。如何通过显示表中的超链接传递值,以及如何放置图像?

工作迭代器代码:

{{1}}

2 个答案:

答案 0 :(得分:0)

我找到了

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

<display:column property="employeeId" title="Delete" href="delete" paramId="value" paramProperty="employeeId" >

答案 1 :(得分:0)

您需要为display:table添加两列以进行编辑,将另一列添加到删除网址中。还要为标记添加uid="row"属性。

<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> 

您可以在此处找到完整示例:Pagination in Struts 2 Using display tag