Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Greg Lindholm
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

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
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;

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Greg Lindholm
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;

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
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

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Greg Lindholm
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

RE: updating or deleting a component from a collection through display tag

2009-07-13 Thread Martin Gainty
@Table(name = TableNameGoesHere) //the java file would use ForeignKey annotation as described @org.hibernate.annotations.ForeignKey(name = FK_GOALTOACHIEVE_ID) public class WikiDocument extends WikiFileWikiDocument implements Serializable { public String getHistoricalEntityName() {

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
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

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
Thanks for the comments Martin, I will try it out! On Mon, Jul 13, 2009 at 9:46 AM, Martin Gaintymgai...@hotmail.com wrote: @Table(name = TableNameGoesHere) //the java file would use ForeignKey annotation as described @org.hibernate.annotations.ForeignKey(name = FK_GOALTOACHIEVE_ID) public

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Greg Lindholm
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} /

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
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+lastNameid=1 The name and id params are fields of the parent object, the one containing the collection. Actually, I tried with

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Greg Lindholm
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

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
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

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Musachy Barroso
Assuming that each entry is named entry by displayTag, you can access it using #attr.entry (or #attr['entry']) to access it from the S2 tags. musachy On Mon, Jul 13, 2009 at 10:27 AM, Dimitrios Christodoulakisdimi@gmail.com wrote: Yes, that is exactly the case, hmm.. Although, how is the

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
Thanks. So, if I wanted to access a particular property (say this property is called mark) of an entry object which I am iterating over, I would do something like the following: display:table name=goalToAchieve.entries requestURI= uid=thisGoal display:column property=entry / display:column

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Musachy Barroso
The current row used by displaytag is pushed under the name set in uid, so you could do this: display:table name=goalToAchieve.entries requestURI= uid=thisGoal display:column a href=s:url action='DeleteEntryForm' escapeAmp=false s:param name=date value=#attr.thisGoal.mark / /s:url Remove/a

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
Hey, this worked! Thanks Musachy, the tip you provided solved the problem I was facing for the last 3 days. I really appreciate your time to post this information. It looks like the display tag packs much more functionality than it seems. On Mon, Jul 13, 2009 at 2:03 PM, Musachy

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
Thanks again for helping out Musachy, I was wondering if there are any rules regarding when the notation you suggested below can be used. it works perfectly for setting url params. I was trying to use it (with struts2 tags) within a form (which is within the display:column tag) to pass the value

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Musachy Barroso
you can sue that notation anywhere. A tip that will save you a lot of time, always wrap the OGNl expressions with %{}, that's why the first hidden is not getting evaluated. The second one has an empty value because goalToAchieve is probably not pointing to anything. btw what #attr does is search

Re: updating or deleting a component from a collection through display tag

2009-07-13 Thread Dimitrios Christodoulakis
Great, many thanks again for the information. I bet others will find it pretty handy too! On Mon, Jul 13, 2009 at 9:23 PM, Musachy Barrosomusa...@gmail.com wrote: you can sue that notation anywhere. A tip that will save you a lot of time, always wrap the OGNl expressions with %{}, that's why