views:

402

answers:

2

i am displaying a object detail through display tag. now i want a link in page through which user can delete or edit that particular record so i want a link which has object id as value and pass it to action class. or any other way so that i can delete or edit perticular record thank in advance

A: 

Take a look at display:column, you can use the href and paramId to pass unique id to the url to delete a particular record.

Bhushan
A: 

<

 display:table name="sessionScope.searchResults"
    cellpadding="1" uid="sr" pagesize="50" cellspacing="1" size="50"
    defaultorder="ascending" sort="list" style="width:850"
     id="row">
    <display:column media="html"
    title="Delete"
    style="text-align:center">
    <s:url id="deleteUrl" action="deleteLink.action">
    <s:param name="objectId" value="#attr.row.OBJECT_ID" />
    </s:url>
    <s:a href="%{deleteUrl}">
         Delete
    </s:a>
</display:column>

</display:table>

OBJECT_ID is the ID of the current rows object, send the id to your action class load the obect with the id and do what ever you want to do.

You will get a hyper link on Delete image, Clicking on Delete will send you to deleteLink.action

Muhammad Shahid