Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 14 Jul 2009 05:22:11 -0000 Issue 8749

user-digest-help

2009-07-14


Author LoginPost Reply

user Digest 14 Jul 2009 05:22:11 -0000 Issue 8749

Topics (messages 200678 through 200689):

Re: updating or deleting a component from a collection through display tag
 200678 by: Dimitrios Christodoulakis
 200685 by: Dimitrios Christodoulakis
 200686 by: Musachy Barroso
 200687 by: Dimitrios Christodoulakis

[Struts 2.1] Using a s:select with type conversion
 200679 by: dcabasson
 200683 by: Musachy Barroso

Re: For s:textfield tag how to get value for title attribute from resource bundle.
 200680 by: Dave Newton
 200688 by: wkbutler

Re: Uploading large files
 200681 by: Dale Newfield
 200682 by: Wes Wannemacher

Re: MethodFilterInterceptor <package>
 200684 by: Musachy Barroso

exception :java.lang.NoClassDefFoundError: org/apache/commons/digester/RuleSet
 200689 by: jayadevan

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------


Attachment: user_200678.ezm (zipped)
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 Barroso<musachy@(protected):
> 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>
> </display:column>
>
> musachy
>
> On Mon, Jul 13, 2009 at 11:17 AM, Dimitrios
> Christodoulakis<dimi.chr@(protected):
>> 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 property="date" sortable="true"
>> defaultorder="ascending" title="TimeStamp"/>
>> <display:column property="mark" />
>> <display:column>
>> <a href="<s:url action='DeleteEntryForm' escapeAmp="false">
>> <s:param name="name" value="%{goalToAchieve.owner.fullName}" />
>> <s:param name="id" value="%{goalToAchieve.id}" />
>> <s:param name="date" value="#attr.entry.mark" />
>>   </s:url>
>> ">Remove</a>
>> </display:column>
>>
>> So, I could pass mark as a url param via s:url within the display tag?
>>
>> Thanks for the information!
>>
>> On Mon, Jul 13, 2009 at 1:08 PM, Musachy Barroso<musachy@(protected):
>>> 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
>>> Christodoulakis<dimi.chr@(protected):
>>>> 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.lindholm@(protected):
>>>>> 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.chr@(protected):
>>>>>
>>>>>> 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.lindholm@(protected)>
>>>>>> 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.chr@(protected):
>>>>>> >
>>>>>> >> 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",
>>>>>> >> joinColumns=@(protected)"))
>>>>>> >> 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.lindholm@(protected)>
>>>>>> >> 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.chr@(protected):
>>>>>> >> >
>>>>>> >> >> 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-unsubscribe@(protected)
>>>>>> >> For additional commands, e-mail: user-help@(protected)
>>>>>> >>
>>>>>> >>
>>>>>> >
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_200685.ezm (zipped)
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 to an action:

<display:column>  
   <s:form action="UpdateEntryForm">
   <s:hidden name="mark" value="#attr.thisEntry.mark" />
   <s:hiddenname="name" value="%{goalToAchieve.name}" />
   <s:submit value="Edit"/>
   </s:form>
</display:column>

This creates an "Edit" button in each row for every object I iterate
over, and I hoped to use the s:hidden tag to populate the underlying
UpdateEntryForm action. I also try to test it by printing from the
execute method as listed below, but the console output is just the
literal for the mark and zero for the primitive:

This id is: 0
This name is: #attr.thisEntry.mark

My action class:

public class UpdateEntryForm extends ActionSupport{
public String execute(){
   System.out.println("This id is: "+ getId());
   System.out.println("This name is: "+ getMark());
   return SUCCESS;  
 }
private String name;
private long mark;
public String getName() {
   return name;
 }
 public void setName(String name){
   this.name = name;
 }
 
 public String getMark() {
   return mark;
 }
 public void setMark(String mark){
   this.mark = mark;
 }
}

Is there something wrong with the code above? Thanks again!

On Mon, Jul 13, 2009 at 2:03 PM, Musachy Barroso<musachy@(protected):
> 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>
> </display:column>
>
> musachy
>
> On Mon, Jul 13, 2009 at 11:17 AM, Dimitrios
> Christodoulakis<dimi.chr@(protected):
>> 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 property="date" sortable="true"
>> defaultorder="ascending" title="TimeStamp"/>
>> <display:column property="mark" />
>> <display:column>
>> <a href="<s:url action='DeleteEntryForm' escapeAmp="false">
>> <s:param name="name" value="%{goalToAchieve.owner.fullName}" />
>> <s:param name="id" value="%{goalToAchieve.id}" />
>> <s:param name="date" value="#attr.entry.mark" />
>>   </s:url>
>> ">Remove</a>
>> </display:column>
>>
>> So, I could pass mark as a url param via s:url within the display tag?
>>
>> Thanks for the information!
>>
>> On Mon, Jul 13, 2009 at 1:08 PM, Musachy Barroso<musachy@(protected):
>>> 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
>>> Christodoulakis<dimi.chr@(protected):
>>>> 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.lindholm@(protected):
>>>>> 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.chr@(protected):
>>>>>
>>>>>> 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.lindholm@(protected)>
>>>>>> 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.chr@(protected):
>>>>>> >
>>>>>> >> 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",
>>>>>> >> joinColumns=@(protected)"))
>>>>>> >> 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.lindholm@(protected)>
>>>>>> >> 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.chr@(protected):
>>>>>> >> >
>>>>>> >> >> 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-unsubscribe@(protected)
>>>>>> >> For additional commands, e-mail: user-help@(protected)
>>>>>> >>
>>>>>> >>
>>>>>> >
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_200686.ezm (zipped)
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 for a value in all scopes (page,
request, session , application)

musahcy

On Mon, Jul 13, 2009 at 5:57 PM, Dimitrios
Christodoulakis<dimi.chr@(protected):
> 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 to an action:
>
> <display:column>
>        <s:form action="UpdateEntryForm">
>        <s:hidden name="mark" value="#attr.thisEntry.mark" />
>        <s:hiddenname="name" value="%{goalToAchieve.name}" />
>        <s:submit value="Edit"/>
>        </s:form>
> </display:column>
>
> This creates an "Edit" button in each row for every object I iterate
> over, and I hoped to use the s:hidden tag to populate the underlying
> UpdateEntryForm action. I also try to test it by printing from the
> execute method as listed below, but the console output is just the
> literal for the mark and zero for the primitive:
>
> This id is: 0
> This name is: #attr.thisEntry.mark
>
> My action class:
>
> public class UpdateEntryForm extends ActionSupport{
> public String execute(){
>                System.out.println("This id is: "+ getId());
>                System.out.println("This name is: "+ getMark());
>                return SUCCESS;
>        }
> private String name;
> private long mark;
> public String getName() {
>                return name;
>        }
>        public void setName(String name){
>                this.name = name;
>        }
>
>        public String getMark() {
>                return mark;
>        }
>        public void setMark(String mark){
>                this.mark = mark;
>        }
> }
>
> Is there something wrong with the code above? Thanks again!
>
> On Mon, Jul 13, 2009 at 2:03 PM, Musachy Barroso<musachy@(protected):
>> 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>
>> </display:column>
>>
>> musachy
>>
>> On Mon, Jul 13, 2009 at 11:17 AM, Dimitrios
>> Christodoulakis<dimi.chr@(protected):
>>> 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 property="date" sortable="true"
>>> defaultorder="ascending" title="TimeStamp"/>
>>> <display:column property="mark" />
>>> <display:column>
>>> <a href="<s:url action='DeleteEntryForm' escapeAmp="false">
>>> <s:param name="name" value="%{goalToAchieve.owner.fullName}" />
>>> <s:param name="id" value="%{goalToAchieve.id}" />
>>> <s:param name="date" value="#attr.entry.mark" />
>>>   </s:url>
>>> ">Remove</a>
>>> </display:column>
>>>
>>> So, I could pass mark as a url param via s:url within the display tag?
>>>
>>> Thanks for the information!
>>>
>>> On Mon, Jul 13, 2009 at 1:08 PM, Musachy Barroso<musachy@(protected):
>>>> 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
>>>> Christodoulakis<dimi.chr@(protected):
>>>>> 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.lindholm@(protected):
>>>>>> 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.chr@(protected):
>>>>>>
>>>>>>> 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.lindholm@(protected)>
>>>>>>> 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.chr@(protected):
>>>>>>> >
>>>>>>> >> 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",
>>>>>>> >> joinColumns=@(protected)"))
>>>>>>> >> 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.lindholm@(protected)>
>>>>>>> >> 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.chr@(protected):
>>>>>>> >> >
>>>>>>> >> >> 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-unsubscribe@(protected)
>>>>>>> >> For additional commands, e-mail: user-help@(protected)
>>>>>>> >>
>>>>>>> >>
>>>>>>> >
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Attachment: user_200687.ezm (zipped)
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 Barroso<musachy@(protected):
> 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 for a value in all scopes (page,
> request, session , application)
>
> musahcy
>
> On Mon, Jul 13, 2009 at 5:57 PM, Dimitrios
> Christodoulakis<dimi.chr@(protected):
>> 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 to an action:
>>
>> <display:column>
>>        <s:form action="UpdateEntryForm">
>>        <s:hidden name="mark" value="#attr.thisEntry.mark" />
>>        <s:hiddenname="name" value="%{goalToAchieve.name}" />
>>        <s:submit value="Edit"/>
>>        </s:form>
>> </display:column>
>>
>> This creates an "Edit" button in each row for every object I iterate
>> over, and I hoped to use the s:hidden tag to populate the underlying
>> UpdateEntryForm action. I also try to test it by printing from the
>> execute method as listed below, but the console output is just the
>> literal for the mark and zero for the primitive:
>>
>> This id is: 0
>> This name is: #attr.thisEntry.mark
>>
>> My action class:
>>
>> public class UpdateEntryForm extends ActionSupport{
>> public String execute(){
>>                System.out.println("This id is: "+ getId());
>>                System.out.println("This name is: "+ getMark());
>>                return SUCCESS;
>>        }
>> private String name;
>> private long mark;
>> public String getName() {
>>                return name;
>>        }
>>        public void setName(String name){
>>                this.name = name;
>>        }
>>
>>        public String getMark() {
>>                return mark;
>>        }
>>        public void setMark(String mark){
>>                this.mark = mark;
>>        }
>> }
>>
>> Is there something wrong with the code above? Thanks again!
>>
>> On Mon, Jul 13, 2009 at 2:03 PM, Musachy Barroso<musachy@(protected):
>>> 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>
>>> </display:column>
>>>
>>> musachy
>>>
>>> On Mon, Jul 13, 2009 at 11:17 AM, Dimitrios
>>> Christodoulakis<dimi.chr@(protected):
>>>> 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 property="date" sortable="true"
>>>> defaultorder="ascending" title="TimeStamp"/>
>>>> <display:column property="mark" />
>>>> <display:column>
>>>> <a href="<s:url action='DeleteEntryForm' escapeAmp="false">
>>>> <s:param name="name" value="%{goalToAchieve.owner.fullName}" />
>>>> <s:param name="id" value="%{goalToAchieve.id}" />
>>>> <s:param name="date" value="#attr.entry.mark" />
>>>>   </s:url>
>>>> ">Remove</a>
>>>> </display:column>
>>>>
>>>> So, I could pass mark as a url param via s:url within the display tag?
>>>>
>>>> Thanks for the information!
>>>>
>>>> On Mon, Jul 13, 2009 at 1:08 PM, Musachy Barroso<musachy@(protected):
>>>>> 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
>>>>> Christodoulakis<dimi.chr@(protected):
>>>>>> 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.lindholm@(protected):
>>>>>>> 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.chr@(protected):
>>>>>>>
>>>>>>>> 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.lindholm@(protected)>
>>>>>>>> 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.chr@(protected):
>>>>>>>> >
>>>>>>>> >> 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",
>>>>>>>> >> joinColumns=@(protected)"))
>>>>>>>> >> 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.lindholm@(protected)>
>>>>>>>> >> 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.chr@(protected):
>>>>>>>> >> >
>>>>>>>> >> >> 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-unsubscribe@(protected)
>>>>>>>> >> For additional commands, e-mail: user-help@(protected)
>>>>>>>> >>
>>>>>>>> >>
>>>>>>>> >
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>>> For additional commands, e-mail: user-help@(protected)
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_200679.ezm (zipped)

Hi, I have trouble understanding the way TypeConversion along a s:select tag.

Any advice on the matter would be welcomed.

I have posted the bug under https://issues.apache.org/struts/browse/WW-3184
attaching a simple Use Case showing what I find to be an unexpected
behaviour.

Thanks for your help!
Denis.
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200683.ezm (zipped)
I don't think you can rely on the select tag for a list of dates, as
it (obviously :)) doesn't know how to convert the dates to string.
What I find strange is that looking at the freemarker code it seems to
be like both the value and the caption should be the same
(toString()):

<@(protected)">
    <#if parameters.listKey??>
       <#if stack.findValue(parameters.listKey)??>
        <#assign itemKey = stack.findValue(parameters.listKey)/>
        <#assign itemKeyStr = stack.findString(parameters.listKey)/>
       <#else>
        <#assign itemKey = ''/>
        <#assign itemKeyStr = ''/>
       </#if>
    <#else>
       <#assign itemKey = stack.findValue('top')/>
       <#assign itemKeyStr = stack.findString('top')>
    </#if>
    <#if parameters.listValue??>
       <#if stack.findString(parameters.listValue)??>
        <#assign itemValue = stack.findString(parameters.listValue)/>
       <#else>
        <#assign itemValue = ''/>
       </#if>
    <#else>
       <#assign itemValue = stack.findString('top')/>
    </#if>
  <option value="${itemKeyStr?html}"<#rt/>
    <#if tag.contains(parameters.nameValue, itemKey) == true>
selected="selected"<#rt/>
    </#if>
  >${itemValue?html}</option><#lt/>
</@(protected)>

btw I just realized that you can put put a method call on the
"listKey" and "listValue", like

<s:select .... listKey="%{SomeConverter.dateToString(top)}"
listValue="%{SomeConverter.dateToCaptionString(top)}" />

I haven't tried tho.
musachy

On Mon, Jul 13, 2009 at 12:23 PM, dcabasson<denis.cabasson@(protected):
>
> Hi, I have trouble understanding the way TypeConversion along a s:select tag.
>
> Any advice on the matter would be welcomed.
>
> I have posted the bug under https://issues.apache.org/struts/browse/WW-3184
> attaching a simple Use Case showing what I find to be an unexpected
> behaviour.
>
> Thanks for your help!
> Denis.
> --
> View this message in context: http://www.nabble.com/-Struts-2.1--Using-a-s%3Aselect-with-type-conversion-tp24467738p24467738.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Attachment: user_200680.ezm (zipped)
wkbutler wrote:
> Bottom line was that the resource props need to be packaged in the
> same package as the action class, with the same name.

getText calls will follow the hierarchy noted in the docs:

http://struts.apache.org/2.1.6/docs/localization.html

Dave


Attachment: user_200688.ezm (zipped)

Yep I did find that, thanks. What I've realized is that I have the OGNL
double-evaluation problem. I'm really trying to get this result for the
s:textfield label:

        label="%{getText('%{formQuestion.question.questionKey}')}"

which of course is not legal, but I guess I'm somewhat surprised that

        label="getText('%{formQuestion.question.questionKey}')"

doesn't get what I need, even though I guess it's technically identical to
the previous AFAIK. The struts docs here
(http://struts.apache.org/2.1.6/docs/tag-syntax.html) are a little vague on
this layered use, but I am seeing if I can get some insight from the OGNL
docs (http://www.opensymphony.com/ognl/html/LanguageGuide/paren.html).

I did try a helper tag like

 <s:set name="labelVal"
value="getText('%{formQuestion.question.questionKey}')"/>

but no luck.

Thanks for wading through my babble. I had my kids in the office today. lol

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200681.ezm (zipped)
Daniele Development-ML wrote:
> I am developing a web application that needs to allow uploading of file of
> sizes ranging 200Mb - 1 GB.

My current app allows for files up to 1GB.

> Currently, I'm doing this with the FileUploadAction, which however
> loads the entire file in memory - as I understood

There's a class with that name in the showcase, but that's not part of
the API. Is this a custom built class you're referring to? What makes
you think it loads the entire file into memory?

> I remember once I came across another possible solution, which allows the
> serialization of the file data as it is received from the server.

I assume that the multipart request processor streams the content into a
file without first loading the entire thing into memory...if you know
that this is not the case, please point out the offending portion of code...

-Dale


Attachment: user_200682.ezm (zipped)
On Mon, Jul 13, 2009 at 4:34 PM, Dale Newfield<dale@(protected):
>
>> I remember once I came across another possible solution, which allows the
>> serialization of the file data as it is received from the server.
>
> I assume that the multipart request processor streams the content into a
> file without first loading the entire thing into memory...if you know that
> this is not the case, please point out the offending portion of code...
>
> -Dale
>

I am pretty sure you are right Dale, there was a JIRA that the choice
was unavailable. The GAE doesn't allow you to write files anywhere on
the filesystem, and there was no option to configure this behavior.
That's one of the reasons I started a plugin. The choices are
available in commons-fileupload, but we just weren't exposing them.
I'm guessing the files are getting serialized (I think the threshold
is way less than what he is talking about), he just didn't see them
anywhere.

-Wes
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


Attachment: user_200684.ezm (zipped)
> independent of the methods' package name

I am not sure what you mean by this. example?

musachy
--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Attachment: user_200689.ezm (zipped)

hi all

i am using struts 1 in my project . when i sart tomcat i got the following
exception
Jul 14, 2009 10:39:05 AM org.apache.catalina.core.ApplicationDispatcher
invoke
SEVERE: Allocate exception for servlet action
java.lang.NoClassDefFoundError: org/apache/commons/digester/RuleSet
 at java.lang.Class.getDeclaredConstructors0(Native Method)
 at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
 at java.lang.Class.getConstructor0(Unknown Source)
 at java.lang.Class.newInstance0(Unknown Source)
 at java.lang.Class.newInstance(Unknown Source)
 at
org.apache.catalina.core.StandardWrapper.loadServlet (StandardWrapper.java:1104)
 at
org.apache.catalina.core.StandardWrapper.allocate (StandardWrapper.java:806)
 at
org.apache.catalina.core.ApplicationDispatcher.invoke (ApplicationDispatcher.java:623)
 at
org.apache.catalina.core.ApplicationDispatcher.processRequest (ApplicationDispatcher.java:445)
 at
org.apache.catalina.core.ApplicationDispatcher.doForward (ApplicationDispatcher.java:379)
 at
org.apache.catalina.core.ApplicationDispatcher.forward (ApplicationDispatcher.java:292)
 at
org.apache.jasper.runtime.PageContextImpl.doForward (PageContextImpl.java:694)
 at
org.apache.jasper.runtime.PageContextImpl.forward (PageContextImpl.java:665)
 at org.apache.jsp.index_jsp._jspService (index_jsp.java:61)
 at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
 at
org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:393)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:320)
 at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:266)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:290)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206)
 at
org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:233)
 at
org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:175)
 at
org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:128)
 at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
 at
org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:109)
 at
org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:263)
 at
org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:844)
 at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Unknown Source)
pls help me

thanks in advance



--
Sent from the Struts - User mailing list archive at Nabble.com.


©2008 gg3721.com - Jax Systems, LLC, U.S.A.