Thanks for the reply. Well, entry is an instance of a separate class:

@Embeddable
public class JournalEntry {
@org.hibernate.annotations.Parent
        private GoalToAchieve goalToAchieve;
@Column(length = 255, nullable = false)
        private String entry;
        
        @Temporal(TemporalType.TIMESTAMP)
        @Column(nullable = false, updatable = false)
        private Date insertDate = new Date();

...plus the getters and setters

This being a value type embeddable component, it is represented with a
table with only a foreign key to the parent entity it belongs to:
goalToAchieve_id

So, if I pass the entry String as a parameter (I am not sure if it
would be convenient to have a a few sentences as url params), how can
I turn it into a reference to the object I want to actually remove
from the collection?

Thanks again

On Mon, Jul 13, 2009 at 8:17 AM, Greg Lindholm<greg.lindh...@gmail.com> wrote:
>>
>>
>> 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.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to