>
>
> I have successfully used the display tag to iterate over a collection
> which is exposed in an action class. On each row in addition to the
> columns displaying the fields of each object in the collection, I
> embed two more struts-tag urls: Update and Remove.
>
> The objective is to have an extra two columns for every row in the
> table giving the ability to update or delete each record:
>
> <display:table name="goalToAchieve.entries" requestURI="" uid="thisGoal">
>        <display:column property="entry" />
>        <display:column property="date" sortable="true"
> defaultorder="ascending" title="TimeStamp"/>
>        <display:column><a href="<s:url action='UpdateEntryForm'>
>                                <s:param name="name"
> value="%{goalToAchieve.owner.fullName}" />
>                        </s:url>
>                        ">Edit</a></display:column>
>        <display:column><a href="<s:url action='DeleteEntryForm'>
>                                        <s:param name="name"
> value="%{goalToAchieve.owner.fullName}" />
>                                        <s:property value="%{entry}"/>
>                                       </s:url>
>                                       ">Remove</a></display:column>
> </display:table>
>
> I am having trouble passing the entry property, (or reference to it)
> to the url targeting the update or delete action. The entries
> collection consists of value type, embeddable objects. I am aware of
> how to pass parameters to the linking url, but my issue is passing a
> reference to the "entry" property of each row, to the update or delete
> action for the same row.
>
>
You didn't say what 'entry' is, but if it is a String or some primitive you
can just pass it as another parameter.

<s:url action='DeleteEntryForm'>
          <s:param name="name" value="%{goalToAchieve.owner.fullName}" />
           <s:param name="entry" value="%{entry}" />
</s:url>

Usually, every database entity object has an 'id' property (primary key) and
you would just pass the id as a parameter so your action can find the object
in the database.

In you browser do a view source on the page to ensure the url is being
generated correctly with the params you are expecting.

Reply via email to