Yes, that is exactly the case, hmm.. Although, how is the
display:table tag finds the collection in the first place?

Supposedly the display has some way of reaching the valuestack, it can
even resolve the deeper notation <display:table
name="goalToAchieve.entries"

However, I will switch back to s:iterator to test if the syntax
suggested will work. I mainly used the display tag as a quick way to
sort the collection, but if I can't access the properties of the
objects I am iterating over, it isn't of much use in this case

On Mon, Jul 13, 2009 at 12:20 PM, Greg Lindholm<greg.lindh...@gmail.com> wrote:
> OK, I see the problem now...  you are not using <s:iterator> to go thru the
> entries, you are using <display:table>.
>
> The syntax suggested will not work since <display:table> does not know
> anything about the value stack.The <s:param name="mark" value="%{mark}" />
> uses the value stack to resolve 'mark' which will not work here, you will
> need to replace %{mark} with the right syntax to work with <display:table>
> iterator.
>
> And I don't know anything about <display:table> so you will need to look up
> how to access the properties of the entities you are iterating over so as to
> build the URL.
>
>
> On Mon, Jul 13, 2009 at 12:28 PM, Dimitrios Christodoulakis <
> dimi....@gmail.com> wrote:
>
>> 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
>>
>>
>

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

Reply via email to