Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 13 Jul 2009 19:04:15 -0000 Issue 8748

user-digest-help

2009-07-13


Author LoginPost Reply

user Digest 13 Jul 2009 19:04:15 -0000 Issue 8748

Topics (messages 200666 through 200677):

Re: validwhen question
 200666 by: Lukasz Lenart
 200673 by: Paul Benedict

Streaming uploading and downloading of big files with Struts, using Common File Upload API
 200667 by: Daniele Development-ML
 200669 by: Wes Wannemacher

Re: updating or deleting a component from a collection through display tag
 200668 by: Dimitrios Christodoulakis
 200671 by: Greg Lindholm
 200672 by: Dimitrios Christodoulakis
 200675 by: Musachy Barroso
 200676 by: Dimitrios Christodoulakis
 200677 by: Musachy Barroso

MethodFilterInterceptor <package>
 200670 by: stanlick

Re: For s:textfield tag how to get value for title attribute from resource bundle.
 200674 by: wkbutler

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_200666.ezm (zipped)
2009/7/13 Odelya YomTov <odelya@(protected)>:
> But I don't see that it works! Why?

Did you try like this?

<var-value>data.category != \'empty\'</var-value>


Regards
--
Lukasz
http://www.lenart.org.pl/
http://dailylog.lenart.org.pl/


Attachment: user_200673.ezm (zipped)
I believe the correct syntax is:

<var>
<var-name>test</var-name>
<var-value>(*this* != null)</var-value>
</var>

But why are you doing this? Such a simple validation can be
accomplished with the "required" validator.

Paul

On Mon, Jul 13, 2009 at 11:20 AM, Lukasz
Lenart<lukasz.lenart@(protected):
> 2009/7/13 Odelya YomTov <odelya@(protected)>:
>> But I don't see that it works! Why?
>
> Did you try like this?
>
> <var-value>data.category != \'empty\'</var-value>
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
> http://dailylog.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_200667.ezm (zipped)
Hello,
I'm trying to understand how to use the Streaming API of the Apache File
Upload Common libraries in conjunction with Struts. I need this as some
files I need to allow the uploading/download are rather big and should be
stored in memory.

What I understood is that I need to define a multipart handler and configure
it to be used in the control element of struts-config.xml. However, I'm a
bit confused how the handler should be implemented.

Anybody has had a similar experience and can share a suggestion or pointer
to useful resources (couldn't find very relevant docs for this issues -
perhaps just searching in the wrong places).

Thanks!

Dan

Attachment: user_200669.ezm (zipped)
I made an attempt at making file uploading capabilities more
pluggable. There is a beta fileupload plugin with info here -

http://cwiki.apache.org/S2PLUGINS/advanced-fileupload-plugin.html

Be aware, you will have to build a snapshot of struts since it depends
on changes that were made after the 2.1.6 release.

There really isn't much to using it, it is mostly backward compatible
with the built-in multipart handler. You just have more configuration
options if you use this plugin. Plus, if you look at the
struts-plugin.xml file, you can see that there is an action where you
can request a json string for status of currently executing uploads.
This way, you could conceivably build a somewhat accurate statusbar.

Check it out and give feedback, that's what'll make it better :)

-Wes

On Mon, Jul 13, 2009 at 12:21 PM, Daniele
Development-ML<daniele.dml@(protected):
> Hello,
> I'm trying to understand how to use the Streaming API of the Apache File
> Upload Common libraries in conjunction with Struts. I need this as some
> files I need to allow the uploading/download are rather big and should be
> stored in memory.
>
> What I understood is that I need to define a multipart handler and configure
> it to be used in the control element of struts-config.xml. However, I'm a
> bit confused how the handler should be implemented.
>
> Anybody has had a similar experience and can share a suggestion or pointer
> to useful resources (couldn't find very relevant docs for this issues -
> perhaps just searching in the wrong places).
>
> Thanks!
>
> Dan
>



--
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_200668.ezm (zipped)
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):
> 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)
>>
>>
>


Attachment: user_200671.ezm (zipped)
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)
>
>

Attachment: user_200672.ezm (zipped)
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)
>>
>>
>


Attachment: user_200675.ezm (zipped)
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


Attachment: user_200676.ezm (zipped)
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)
>
>


Attachment: user_200677.ezm (zipped)
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


Attachment: user_200670.ezm (zipped)

Either I have been asleep at the wheel or have simply lucked into a naming
scheme. It appears the MethodFilterInterceptor is performing its
include/exclude logic independent of the methods' package name. Has anyone
been snapped by this?

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



Attachment: user_200674.ezm (zipped)

OK - I got getText() working via checking out the code in
com.opensymphony.xwork.util.LocalizedTextUtil , and the StrutsInAction book
has a pretty good section this. Bottom line was that the resource props
need to be packaged in the same package as the action class, with the same
name. I preferred another solution however, which was to declare a marker
interface and use the same trick on that (declare props file with same name,
same packaging), and any class implementing that inherits access to that
bundle.

Anyway, my followup question - I can't use the 'key' attribute on this tag:

          <s:textfield
           
name="userResponses[%{#loop.index}].userResponseValues[0].value"
            label="%{getText('formQuestion.question.questionKey')}"
            value="%{userResponseValues[0].value}"
            required="%{formQuestion.required}"
            maxlength="%{formQuestion.maxLength}"
            cssStyle="width:%{fieldSize}px"
            cssClass="text medium"/>


How would you submit a variable as the identifier for the i18n key in the
above? This syntax produces the result for the key "question.questionKey".
It is supposed to be evaluating the value of variable
   formQuestion.question.questionKey

via OGNL object access as finding the value "q.client.firstName" etc.

Any idea how to specify that the inner OGNL translation should happen first?
I have tried
  label="getText('%{formQuestion.question.questionKey}')"

among many others. Haven't found this on the forums, probably missed it
though. Thanks -






wkbutler wrote:
>
> Is this still the only way to get i18n translatations into a struts tag
> from the resource bundle?
>
> I'm trying to get a label on some struts fields, i.e.
>
>           <s:textfield
>            
> name="userResponses[%{#loop.index}].userResponseValues[0].value"
>              label="%{getText('q.client.name.first')}"
>              value="%{userResponseValues[0].value}"
>              required="%{formQuestion.required}"
>              maxlength="%{formQuestion.maxLength}"
>              cssStyle="width:%{fieldSize}px"
>              cssClass="text medium"/>
>
> with a messageSource defined as
>
>  <bean id="messageSource"
> class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
>     <property name="basenames">
>       <list>
>         <value>classpath:/form</value>
>        </list>
>      </property>
>     <property name="cacheSeconds" value="7200"/>
>  </bean>
>
> I've never seen the getText() work successfully, but the following do
> work:
>
> <fmt:setBundle basename="form"/>
> <fmt:message key="q.client.name.first" />
>
> <i18n:bundle baseName="form" id="b1">
>   <i18n:message key="q.client.name.first" bundle="${b1}" />
> </i18n:bundle>
>
> I also have the JSTL message source defined in web.xml still, but removing
> that doesn't help the getText succeed.
>
> Any ideas on getting getText() to work? Or alternatives ways of getting
> an i18n label on the s:textfield? Thanks for any ideas -
>
>
>
>
> LEONARD Julien (Consulting for ACCOR Hotels) wrote:
>>
>> Try this :
>>
>> <s:textfield theme="xhtml" label="" key="categoryName"
>> cssClass="fieldGreen validate-alpha " value=""
>> title="%{getText('category.categoryName')}" id="categoryName"/>
>>
>> http://struts.apache.org/2.0.11/docs/localization.html
>>
>> Julien
>>
>> -----Message d'origine-----
>> De : VJ22 [mailto:Vijay.Nair@(protected)]
>> Envoyé : vendredi 22 février 2008 16:26
>> À : user@(protected)
>> Objet : For s:textfield tag how to get value for title attribute from
>> resource bundle.
>>
>>
>> For s:textfield tag how to get value for title attribute from resource
>> bundle.
>> I tried using <fmt:message> but seems the struts2 is not recognising
>> this inside the title tag and considering it as plain text.
>> Please let me know if there exists a way to do the same For eg i tried
>> <td width="80%"<s:textfield theme="xhtml" label="" key="categoryName"
>> cssClass="fieldGreen validate-alpha " value="" title="<fmt:message
>> key='category.categoryName'/>" id="categoryName"/>
>>
>> Here category.categoryName is refering to resouce bundle property.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/For-s%3Atextfield-tag-how-to-get-value-for-title-attribute-from-resource-bundle.-tp15634305p15634305.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>> ----------------------------------------------------------------------------------------
>>
>>
>
>

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


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