I made the changes, but the view source indicates that the param "mark" is not passed.
The url linked is formed like this: /secure/DeleteEntryForm.action?name=firstName+lastName&id=1 The name and id params are fields of the parent object, the one containing the collection. Actually, I tried with all fields taken from the collection object, like entry, and date but none gets passed as a param. Only properties exposed by the parent object, goalToAchieve are passed, shouldn't I be able to point to a field within a collection object too? It looks like individual collection object properties can be viewed using the iterator/display, but cannot be "captured" or passed as parameters for any other uses... unless I am missing something, or doing something wrong. On Mon, Jul 13, 2009 at 10:50 AM, Greg Lindholm<greg.lindh...@gmail.com> wrote: > Looks like you need to change entry.mark to just mark and remove the > <s:property value="%{entry}"/>. Also you probably don't need to pass both > the name and id of the parent object. > > <a href="<s:url action='DeleteEntryForm' var="entry" escapeAmp="false"> > <s:param name="id" value="%{goalToAchieve.id}" /> > <s:param name="mark" value="%{mark}" /> > </s:url> > ">Remove</a> > > > On Mon, Jul 13, 2009 at 10:48 AM, Dimitrios Christodoulakis < > dimi....@gmail.com> wrote: > >> Thanks for letting me know. Alright, so: >> >> This is the parent class: >> >> @Entity >> public class GoalToAchieve { >> @Id @GeneratedValue >> private Long id; >> >> @org.hibernate.annotations.CollectionOfElements >> @JoinTable (name="GoalToAchieve_entry", >> joincolum...@joincolumn(name="goalToAchieve_id")) >> private Set<JournalEntry> entries = new HashSet<JournalEntry>(); >> >> public Set<JournalEntry> getEntries() { >> return entries; >> } >> public void setEntries(SortedSet<JournalEntry> entries) { >> this.entries = entries; >> } >> >> public void addEntry(JournalEntry newEntry){ >> entries.add(newEntry); >> } >> >> public void deleteEntry(JournalEntry entry){ >> entries.remove(entry); >> } >> ..plus some other standard fields with getters and setters >> >> This is the child-class: >> >> @Embeddable >> public class JournalEntry { >> @org.hibernate.annotations.Parent >> private GoalToAchieve goalToAchieve; >> >> @Column >> private Long mark; >> public Long getMark() { >> return mark; >> } >> public void setMark(long mark){ >> this.mark = mark; >> } >> >> @Column(length = 255, nullable = false) >> private String entry; >> >> @Temporal(TemporalType.TIMESTAMP) >> @Column(nullable = false, updatable = false) >> private Date insertDate = new Date(); >> >> ..plus the rest getters and setters >> >> And this this the jsp part where I display the collection: >> >> <s:if test="goalToAchieve.entries.size > 0"> >> <display:table name="goalToAchieve.entries" requestURI="" uid="thisGoal"> >> <display:column property="entry" /> >> <display:column property="date" sortable="true" >> defaultorder="ascending" title="TimeStamp"/> >> <display:column property="mark" /> >> <display:column> >> <a href="<s:url action='UpdateEntryForm'> >> <s:param name="name" value="%{goalToAchieve.owner.fullName}" /> >> <s:param name="mark" value="#mark" /> >> </s:url> >> ">Edit</a> >> </display:column> >> <display:column> >> <a href="<s:url action='DeleteEntryForm' var="entry" escapeAmp="false"> >> <s:param name="name" value="%{goalToAchieve.owner.fullName}" /> >> <s:param name="id" value="%{goalToAchieve.id}" /> >> <s:param name="mark" value="entry.mark" /> >> <s:property value="%{entry}"/> >> </s:url> >> ">Remove</a> >> </display:column> >> </display:table> >> </s:if> >> >> ..and the delete action, which should take an entry reference and >> remove it from the collections looks like this: >> >> public class DeleteEntry extends ActionSupport{ >> public String execute(){ >> goalToAchieve.deleteEntry(entry); >> >> return SUCCESS; >> } >> >> private JournalEntry entry; >> private GoalToAchieve goalToAchieve; >> private long id; >> >> ... + getters and setters >> >> I guess right now, my problem has become how to pass a parameter >> referring to en entry (the mark field) to the delete action. Next, I >> would do a lookup within the action to find the entry object and >> remove it from the parent object collection, by calling >> deleteEntry(JournalEntry entry) >> >> On Mon, Jul 13, 2009 at 9:16 AM, Greg Lindholm<greg.lindh...@gmail.com> >> wrote: >> > You are not providing enough information for anyone to help you. Since >> you >> > have changed your object and the jsp you had better include them with any >> > request. >> > >> > >> > On Mon, Jul 13, 2009 at 9:51 AM, Dimitrios Christodoulakis < >> > dimi....@gmail.com> wrote: >> > >> >> Yes, that is a great suggestion actually. What I did was to add a new >> >> field based >> >> System.currentTimeMillis(), but the problem is adding it as a url >> >> parameter. >> >> >> >> For example, I am trying to add it as a url parameter below: >> >> >> >> <a href="<s:url action='UpdateEntryForm'> >> >> <s:param name="name" value="%{goalToAchieve.owner.fullName}" /> >> >> <s:param name="mark" value="%{mark}" /> >> >> </s:url> >> >> ">Edit</a> >> >> >> >> But, the only param passed is the fullName. The mark is not added to >> >> the url string. I think this is because the only object available on >> >> the valuestack is goalToAchieve, and using deeper notation I can >> >> reference as deep as the "entries" collection. But not to fields of >> >> each entry object. In other words, the display or iterator help me >> >> view the collection objects, but not extract and use any of their >> >> fields... I am not sure why this is happening, or if I am doing >> >> something wrong. >> >> >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org