You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oscar <os...@gmail.com> on 2009/11/13 19:53:18 UTC

Problem with tag

Hi to all, i have a simple question about <s:iterator> tag. Let's say 
that we have a property in our action of type List, but in that list i 
only store Strings.
When i want to print the value of the list on the JSP i use this code 
snipped:

<s:iterator value="selIngredientes">
    <s:property value="?" />
</s:iterator>

But i don't know if that's right, because i don't know how to put in the 
value attribute of the property tag, because the list isn't a list of 
objects, is a list of simple strings so each object doesn't have a 
property to get the string value.


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


Re: Problem with tag

Posted by Burton Rhodes <bu...@gmail.com>.
do you wants to this?

<s:iterator var="item" value="sellingreidients">
  <s:property value="%{#item}">
<s:iterator/>

On 11/13/09, Oscar <os...@gmail.com> wrote:
> Brian Thompson escribió:
>> Try this:
>>
>> <s:iterator value="selIngredientes">
>>   <s:property />
>> </s:iterator>
>>
>> Calling <s:property> without specifying a value will default to the top of
>> the value stack which ought to be the current element in the list because
>> you're inside the <s:iterator> tag.
>>
>> -Brian
>>
>>
>>
>> On Fri, Nov 13, 2009 at 12:53 PM, Oscar <os...@gmail.com> wrote:
>>
>>
>>> Hi to all, i have a simple question about <s:iterator> tag. Let's say
>>> that
>>> we have a property in our action of type List, but in that list i only
>>> store
>>> Strings.
>>> When i want to print the value of the list on the JSP i use this code
>>> snipped:
>>>
>>> <s:iterator value="selIngredientes">
>>>   <s:property value="?" />
>>> </s:iterator>
>>>
>>> But i don't know if that's right, because i don't know how to put in the
>>> value attribute of the property tag, because the list isn't a list of
>>> objects, is a list of simple strings so each object doesn't have a
>>> property
>>> to get the string value.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>
>>
> Thanks    Brian, it works.
>
> Before your answer i tried this:
>
> <s:iterator value="selIngredientes">
>   <s:property value="selIngredientes" />
> </s:iterator>
>
> But it prints me the values with [] like this:
>
> [TOMATO]
> [PINEAPPLE]
> [ANOTHER]
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Problem with tag

Posted by Oscar <os...@gmail.com>.
Brian Thompson escribió:
> Try this:
>
> <s:iterator value="selIngredientes">
>   <s:property />
> </s:iterator>
>
> Calling <s:property> without specifying a value will default to the top of
> the value stack which ought to be the current element in the list because
> you're inside the <s:iterator> tag.
>
> -Brian
>
>
>
> On Fri, Nov 13, 2009 at 12:53 PM, Oscar <os...@gmail.com> wrote:
>
>   
>> Hi to all, i have a simple question about <s:iterator> tag. Let's say that
>> we have a property in our action of type List, but in that list i only store
>> Strings.
>> When i want to print the value of the list on the JSP i use this code
>> snipped:
>>
>> <s:iterator value="selIngredientes">
>>   <s:property value="?" />
>> </s:iterator>
>>
>> But i don't know if that's right, because i don't know how to put in the
>> value attribute of the property tag, because the list isn't a list of
>> objects, is a list of simple strings so each object doesn't have a property
>> to get the string value.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
>   
Thanks    Brian, it works.

Before your answer i tried this:

<s:iterator value="selIngredientes">
  <s:property value="selIngredientes" />
</s:iterator>

But it prints me the values with [] like this:

[TOMATO]
[PINEAPPLE]
[ANOTHER]





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


Re: Problem with tag

Posted by Brian Thompson <el...@gmail.com>.
Try this:

<s:iterator value="selIngredientes">
  <s:property />
</s:iterator>

Calling <s:property> without specifying a value will default to the top of
the value stack which ought to be the current element in the list because
you're inside the <s:iterator> tag.

-Brian



On Fri, Nov 13, 2009 at 12:53 PM, Oscar <os...@gmail.com> wrote:

> Hi to all, i have a simple question about <s:iterator> tag. Let's say that
> we have a property in our action of type List, but in that list i only store
> Strings.
> When i want to print the value of the list on the JSP i use this code
> snipped:
>
> <s:iterator value="selIngredientes">
>   <s:property value="?" />
> </s:iterator>
>
> But i don't know if that's right, because i don't know how to put in the
> value attribute of the property tag, because the list isn't a list of
> objects, is a list of simple strings so each object doesn't have a property
> to get the string value.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Problem with tag

Posted by Burton Rhodes <bu...@gmail.com>.
all in good fun :)

On 11/14/09, Martin Gainty <mg...@hotmail.com> wrote:
>
> wes ..i think someone that wants to take your class
>
> viel gluck
> Martin
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>
>
>
>
>
>
>> Date: Sat, 14 Nov 2009 20:07:21 -0600
>> Subject: Re: Problem with <s:iterator> tag
>> From: burtonrhodes@gmail.com
>> To: user@struts.apache.org
>>
>> I habe no idea what Martin just wrote means?!
>>
>> On 11/13/09, Martin Gainty <mg...@hotmail.com> wrote:
>> >
>> > //Assuming we have this Action
>> > //A Simple Action Class which demonstrates placing information in a Map
>> > public class GetEntryAction extends ActionSupport
>> > {
>> >     private ArrayList stats_list=new ArrayList(30); //a collection of
>> > stats
>> >     private class stats
>> >     {
>> >       private ArrayList entries_list=new ArrayList(30); // a collection
>> > of
>> > Entries
>> >       String StatusGroupName="StatusGroupName";
>> >       String StatusGroupID="StatusGroupID";
>> >     }
>> >     private class Entry
>> >     {
>> >         String HOHName;
>> >         public String getHOH Name()
>> >         {
>> >             return HOHName;
>> >         }
>> >         public void setHOH Name(String HOHName)
>> >         {
>> >             this.HOHName=HOHName;
>> >         }
>> >         String Price;
>> >         public String getPrice()
>> >         {
>> >             return Price;
>> >         }
>> >         public void setPrice(String price)
>> >         {
>> >             Price=price;
>> >         }
>> >         String OriginalValue;
>> >         public String getOriginalValue()
>> >         {
>> >             return OriginalValue;
>> >         }
>> >         public void setOriginalValue(String str)
>> >         {
>> >             OriginalValue=str;
>> >         }
>> >     }
>> >     public String execute() throws Exception
>> >     {
>> >
>> >               Map session =
>> > com.opensymphony.xwork2.ActionContext.getContext().getSession();
>> >
>> >               //construct new Uber stats class
>> >                         stats stats1=new stats();
>> >                         stats1.StatusGroupName=new
>> > String("StatusGroupName1");
>> >                         stats1.StatusGroupID=new
>> > String("StatusGroupID");
>> >
>> >               //Name,Value,OriginalValue
>> > //construct the 1st entry
>> >               Entry entry1=new Entry();
>> >               entry1.setHOHName("ALL");
>> >               entry1.setPrice("50.00");
>> >               entry1.setOriginalValue("10.00");
>> > //put it into stats Map
>> >                         stats1.entries_list.add(entry1);
>> >
>> > //construct the second entry
>> >               Entry entry2=new Entry();
>> >               entry2.setHOHName("ALL");
>> >               entry2.setPrice("50.00");
>> >               entry2.setOriginalValue("10.00");
>> > //put it into entries Map
>> >                         stats1.entries_list.add(entry2);
>> >
>> >                         //put the stats class into stats_list
>> >                         stats_list.add(stats1);
>> >
>> >               //construct new Uber stats class
>> >                         stats stats2=new stats();
>> >                         stats2.StatusGroupName=new
>> > String("StatusGroupName2");
>> >                         stats2.StatusGroupID=new
>> > String("StatusGroupID2");
>> >
>> > //construct the 1st entry
>> >               Entry entry2a=new Entry();
>> >               entry2a.setHOHName("ALL");
>> >               entry2a.setPrice("50.00");
>> >               entry2a.setOriginalValue("10.00");
>> > //put it into stats Map
>> >                         stats2.entries_list.add(entry2a);
>> >
>> > //construct the second entry
>> >               Entry entry2b=new Entry();
>> >               entry2b.setHOHName("ALL");
>> >               entry2b.setPrice("50.00");
>> >               entry2b.setOriginalValue("10.00");
>> > //put it into entries Map
>> >                         stats2.entries_list.add(entry2b);
>> >
>> >                   session.put("stats_list",stats_list);
>> > //All of the information you require is now in the map which is now in
>> > the
>> > Session
>> >              return SUCCESS;
>> >     }
>> > }
>> >
>> > <s:iterator value="#session.stats_list" status="statsStatus"
>> > var="stats_list">
>> >      <tr class="<s:if test="#statsStatus.odd == true
>> > ">odd</s:if><s:else>even</s:else>">
>> >          <td><s:property value="name" /></td>
>> >          <td><s:property value="description" /></td>
>> >          <td>
>> >              <!-- notice the statsStatus.indexis used to refer to
>> > iterate
>> > from -->
>> >              <s:iterator
>> > value="#session.stats_list.entries_list('#statsStatus.index')"
>> > status="userStatus" var="user_list">
>> >
>> >                  <!-- display HOHName for anything other than 0 entry
>> > -->
>> >                  <s:property value="HOHName" /><s:if
>> > test="!#userStatus.index">,</s:if>
>> >
>> >              </s:iterator>
>> >          </td>
>> >      </tr>
>> >  </s:iterator>
>> >
>> > a few things to notice:
>> > notice how the index from statsStatus outer loop is being used for the
>> > session_stats inner loop
>> > also take a look at this List which is later pushed onto OGNLStack
>> > (session)
>> > private ArrayList stats_list=new ArrayList(30); //a collection of stats
>> > and then referenced later on as #session.stats_list
>> >
>> > once inside the session.stats_list there is a inner list
>> > private ArrayList entries_list=new ArrayList(30);
>> > which is populated and pushed onto OGNLStack (session)
>> > and then referenced later on as #session.stats_list.entries_list
>> >
>> >  Martin Gainty
>> > ______________________________________________
>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>> >
>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
>> > unbefugte
>> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
>> > Nachricht
>> > dient lediglich dem Austausch von Informationen und entfaltet keine
>> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
>> > le
>> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
>> > copie
>> > de ceci est interdite. Ce message sert à l'information seulement et
>> > n'aura
>> > pas n'importe quel effet légalement obligatoire. Étant donné que les
>> > email
>> > peuvent facilement être sujets à la manipulation, nous ne pouvons
>> > accepter
>> > aucune responsabilité pour le contenu fourni.
>> >
>> >
>> >
>> >
>> >> Date: Fri, 13 Nov 2009 12:53:18 -0600
>> >> From: oscar.kalderon@gmail.com
>> >> To: user@struts.apache.org
>> >> Subject: Problem with <s:iterator> tag
>> >>
>> >> Hi to all, i have a simple question about <s:iterator> tag. Let's say
>> >> that we have a property in our action of type List, but in that list i
>> >> only store Strings.
>> >> When i want to print the value of the list on the JSP i use this code
>> >> snipped:
>> >>
>> >> <s:iterator value="selIngredientes">
>> >>     <s:property value="?" />
>> >> </s:iterator>
>> >>
>> >> But i don't know if that's right, because i don't know how to put in
>> >> the
>> >> value attribute of the property tag, because the list isn't a list of
>> >> objects, is a list of simple strings so each object doesn't have a
>> >> property to get the string value.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >  		 	   		
>> > _________________________________________________________________
>> > Hotmail: Trusted email with Microsoft's powerful SPAM protection.
>> > http://clk.atdmt.com/GBL/go/177141664/direct/01/
>> > http://clk.atdmt.com/GBL/go/177141664/direct/01/
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>  		 	   		
> _________________________________________________________________
> Bing brings you maps, menus, and reviews organized in one place.
> http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1

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


RE: Problem with tag

Posted by Martin Gainty <mg...@hotmail.com>.
wes ..i think someone that wants to take your class

viel gluck
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.






> Date: Sat, 14 Nov 2009 20:07:21 -0600
> Subject: Re: Problem with <s:iterator> tag
> From: burtonrhodes@gmail.com
> To: user@struts.apache.org
> 
> I habe no idea what Martin just wrote means?!
> 
> On 11/13/09, Martin Gainty <mg...@hotmail.com> wrote:
> >
> > //Assuming we have this Action
> > //A Simple Action Class which demonstrates placing information in a Map
> > public class GetEntryAction extends ActionSupport
> > {
> >     private ArrayList stats_list=new ArrayList(30); //a collection of stats
> >     private class stats
> >     {
> >       private ArrayList entries_list=new ArrayList(30); // a collection of
> > Entries
> >       String StatusGroupName="StatusGroupName";
> >       String StatusGroupID="StatusGroupID";
> >     }
> >     private class Entry
> >     {
> >         String HOHName;
> >         public String getHOH Name()
> >         {
> >             return HOHName;
> >         }
> >         public void setHOH Name(String HOHName)
> >         {
> >             this.HOHName=HOHName;
> >         }
> >         String Price;
> >         public String getPrice()
> >         {
> >             return Price;
> >         }
> >         public void setPrice(String price)
> >         {
> >             Price=price;
> >         }
> >         String OriginalValue;
> >         public String getOriginalValue()
> >         {
> >             return OriginalValue;
> >         }
> >         public void setOriginalValue(String str)
> >         {
> >             OriginalValue=str;
> >         }
> >     }
> >     public String execute() throws Exception
> >     {
> >
> >               Map session =
> > com.opensymphony.xwork2.ActionContext.getContext().getSession();
> >
> >               //construct new Uber stats class
> >                         stats stats1=new stats();
> >                         stats1.StatusGroupName=new
> > String("StatusGroupName1");
> >                         stats1.StatusGroupID=new String("StatusGroupID");
> >
> >               //Name,Value,OriginalValue
> > //construct the 1st entry
> >               Entry entry1=new Entry();
> >               entry1.setHOHName("ALL");
> >               entry1.setPrice("50.00");
> >               entry1.setOriginalValue("10.00");
> > //put it into stats Map
> >                         stats1.entries_list.add(entry1);
> >
> > //construct the second entry
> >               Entry entry2=new Entry();
> >               entry2.setHOHName("ALL");
> >               entry2.setPrice("50.00");
> >               entry2.setOriginalValue("10.00");
> > //put it into entries Map
> >                         stats1.entries_list.add(entry2);
> >
> >                         //put the stats class into stats_list
> >                         stats_list.add(stats1);
> >
> >               //construct new Uber stats class
> >                         stats stats2=new stats();
> >                         stats2.StatusGroupName=new
> > String("StatusGroupName2");
> >                         stats2.StatusGroupID=new String("StatusGroupID2");
> >
> > //construct the 1st entry
> >               Entry entry2a=new Entry();
> >               entry2a.setHOHName("ALL");
> >               entry2a.setPrice("50.00");
> >               entry2a.setOriginalValue("10.00");
> > //put it into stats Map
> >                         stats2.entries_list.add(entry2a);
> >
> > //construct the second entry
> >               Entry entry2b=new Entry();
> >               entry2b.setHOHName("ALL");
> >               entry2b.setPrice("50.00");
> >               entry2b.setOriginalValue("10.00");
> > //put it into entries Map
> >                         stats2.entries_list.add(entry2b);
> >
> >                   session.put("stats_list",stats_list);
> > //All of the information you require is now in the map which is now in the
> > Session
> >              return SUCCESS;
> >     }
> > }
> >
> > <s:iterator value="#session.stats_list" status="statsStatus"
> > var="stats_list">
> >      <tr class="<s:if test="#statsStatus.odd == true
> > ">odd</s:if><s:else>even</s:else>">
> >          <td><s:property value="name" /></td>
> >          <td><s:property value="description" /></td>
> >          <td>
> >              <!-- notice the statsStatus.indexis used to refer to iterate
> > from -->
> >              <s:iterator
> > value="#session.stats_list.entries_list('#statsStatus.index')"
> > status="userStatus" var="user_list">
> >
> >                  <!-- display HOHName for anything other than 0 entry -->
> >                  <s:property value="HOHName" /><s:if
> > test="!#userStatus.index">,</s:if>
> >
> >              </s:iterator>
> >          </td>
> >      </tr>
> >  </s:iterator>
> >
> > a few things to notice:
> > notice how the index from statsStatus outer loop is being used for the
> > session_stats inner loop
> > also take a look at this List which is later pushed onto OGNLStack (session)
> > private ArrayList stats_list=new ArrayList(30); //a collection of stats
> > and then referenced later on as #session.stats_list
> >
> > once inside the session.stats_list there is a inner list
> > private ArrayList entries_list=new ArrayList(30);
> > which is populated and pushed onto OGNLStack (session)
> > and then referenced later on as #session.stats_list.entries_list
> >
> >  Martin Gainty
> > ______________________________________________
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> >
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> > dient lediglich dem Austausch von Informationen und entfaltet keine
> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> > de ceci est interdite. Ce message sert à l'information seulement et n'aura
> > pas n'importe quel effet légalement obligatoire. Étant donné que les email
> > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> > aucune responsabilité pour le contenu fourni.
> >
> >
> >
> >
> >> Date: Fri, 13 Nov 2009 12:53:18 -0600
> >> From: oscar.kalderon@gmail.com
> >> To: user@struts.apache.org
> >> Subject: Problem with <s:iterator> tag
> >>
> >> Hi to all, i have a simple question about <s:iterator> tag. Let's say
> >> that we have a property in our action of type List, but in that list i
> >> only store Strings.
> >> When i want to print the value of the list on the JSP i use this code
> >> snipped:
> >>
> >> <s:iterator value="selIngredientes">
> >>     <s:property value="?" />
> >> </s:iterator>
> >>
> >> But i don't know if that's right, because i don't know how to put in the
> >> value attribute of the property tag, because the list isn't a list of
> >> objects, is a list of simple strings so each object doesn't have a
> >> property to get the string value.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >  		 	   		
> > _________________________________________________________________
> > Hotmail: Trusted email with Microsoft's powerful SPAM protection.
> > http://clk.atdmt.com/GBL/go/177141664/direct/01/
> > http://clk.atdmt.com/GBL/go/177141664/direct/01/
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  
_________________________________________________________________
Bing brings you maps, menus, and reviews organized in one place.
http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1

Re: Problem with tag

Posted by Musachy Barroso <mu...@gmail.com>.
just ignore him, he is a resident troll.

On Sat, Nov 14, 2009 at 6:07 PM, Burton Rhodes <bu...@gmail.com> wrote:
> I habe no idea what Martin just wrote means?!
>
> On 11/13/09, Martin Gainty <mg...@hotmail.com> wrote:
>>
>> //Assuming we have this Action
>> //A Simple Action Class which demonstrates placing information in a Map
>> public class GetEntryAction extends ActionSupport
>> {
>>     private ArrayList stats_list=new ArrayList(30); //a collection of stats
>>     private class stats
>>     {
>>       private ArrayList entries_list=new ArrayList(30); // a collection of
>> Entries
>>       String StatusGroupName="StatusGroupName";
>>       String StatusGroupID="StatusGroupID";
>>     }
>>     private class Entry
>>     {
>>         String HOHName;
>>         public String getHOH Name()
>>         {
>>             return HOHName;
>>         }
>>         public void setHOH Name(String HOHName)
>>         {
>>             this.HOHName=HOHName;
>>         }
>>         String Price;
>>         public String getPrice()
>>         {
>>             return Price;
>>         }
>>         public void setPrice(String price)
>>         {
>>             Price=price;
>>         }
>>         String OriginalValue;
>>         public String getOriginalValue()
>>         {
>>             return OriginalValue;
>>         }
>>         public void setOriginalValue(String str)
>>         {
>>             OriginalValue=str;
>>         }
>>     }
>>     public String execute() throws Exception
>>     {
>>
>>               Map session =
>> com.opensymphony.xwork2.ActionContext.getContext().getSession();
>>
>>               //construct new Uber stats class
>>                         stats stats1=new stats();
>>                         stats1.StatusGroupName=new
>> String("StatusGroupName1");
>>                         stats1.StatusGroupID=new String("StatusGroupID");
>>
>>               //Name,Value,OriginalValue
>> //construct the 1st entry
>>               Entry entry1=new Entry();
>>               entry1.setHOHName("ALL");
>>               entry1.setPrice("50.00");
>>               entry1.setOriginalValue("10.00");
>> //put it into stats Map
>>                         stats1.entries_list.add(entry1);
>>
>> //construct the second entry
>>               Entry entry2=new Entry();
>>               entry2.setHOHName("ALL");
>>               entry2.setPrice("50.00");
>>               entry2.setOriginalValue("10.00");
>> //put it into entries Map
>>                         stats1.entries_list.add(entry2);
>>
>>                         //put the stats class into stats_list
>>                         stats_list.add(stats1);
>>
>>               //construct new Uber stats class
>>                         stats stats2=new stats();
>>                         stats2.StatusGroupName=new
>> String("StatusGroupName2");
>>                         stats2.StatusGroupID=new String("StatusGroupID2");
>>
>> //construct the 1st entry
>>               Entry entry2a=new Entry();
>>               entry2a.setHOHName("ALL");
>>               entry2a.setPrice("50.00");
>>               entry2a.setOriginalValue("10.00");
>> //put it into stats Map
>>                         stats2.entries_list.add(entry2a);
>>
>> //construct the second entry
>>               Entry entry2b=new Entry();
>>               entry2b.setHOHName("ALL");
>>               entry2b.setPrice("50.00");
>>               entry2b.setOriginalValue("10.00");
>> //put it into entries Map
>>                         stats2.entries_list.add(entry2b);
>>
>>                   session.put("stats_list",stats_list);
>> //All of the information you require is now in the map which is now in the
>> Session
>>              return SUCCESS;
>>     }
>> }
>>
>> <s:iterator value="#session.stats_list" status="statsStatus"
>> var="stats_list">
>>      <tr class="<s:if test="#statsStatus.odd == true
>> ">odd</s:if><s:else>even</s:else>">
>>          <td><s:property value="name" /></td>
>>          <td><s:property value="description" /></td>
>>          <td>
>>              <!-- notice the statsStatus.indexis used to refer to iterate
>> from -->
>>              <s:iterator
>> value="#session.stats_list.entries_list('#statsStatus.index')"
>> status="userStatus" var="user_list">
>>
>>                  <!-- display HOHName for anything other than 0 entry -->
>>                  <s:property value="HOHName" /><s:if
>> test="!#userStatus.index">,</s:if>
>>
>>              </s:iterator>
>>          </td>
>>      </tr>
>>  </s:iterator>
>>
>> a few things to notice:
>> notice how the index from statsStatus outer loop is being used for the
>> session_stats inner loop
>> also take a look at this List which is later pushed onto OGNLStack (session)
>> private ArrayList stats_list=new ArrayList(30); //a collection of stats
>> and then referenced later on as #session.stats_list
>>
>> once inside the session.stats_list there is a inner list
>> private ArrayList entries_list=new ArrayList(30);
>> which is populated and pushed onto OGNLStack (session)
>> and then referenced later on as #session.stats_list.entries_list
>>
>>  Martin Gainty
>> ______________________________________________
>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>
>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> dient lediglich dem Austausch von Informationen und entfaltet keine
>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
>> destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>> de ceci est interdite. Ce message sert à l'information seulement et n'aura
>> pas n'importe quel effet légalement obligatoire. Étant donné que les email
>> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>> aucune responsabilité pour le contenu fourni.
>>
>>
>>
>>
>>> Date: Fri, 13 Nov 2009 12:53:18 -0600
>>> From: oscar.kalderon@gmail.com
>>> To: user@struts.apache.org
>>> Subject: Problem with <s:iterator> tag
>>>
>>> Hi to all, i have a simple question about <s:iterator> tag. Let's say
>>> that we have a property in our action of type List, but in that list i
>>> only store Strings.
>>> When i want to print the value of the list on the JSP i use this code
>>> snipped:
>>>
>>> <s:iterator value="selIngredientes">
>>>     <s:property value="?" />
>>> </s:iterator>
>>>
>>> But i don't know if that's right, because i don't know how to put in the
>>> value attribute of the property tag, because the list isn't a list of
>>> objects, is a list of simple strings so each object doesn't have a
>>> property to get the string value.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> _________________________________________________________________
>> Hotmail: Trusted email with Microsoft's powerful SPAM protection.
>> http://clk.atdmt.com/GBL/go/177141664/direct/01/
>> http://clk.atdmt.com/GBL/go/177141664/direct/01/
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Problem with tag

Posted by Burton Rhodes <bu...@gmail.com>.
I habe no idea what Martin just wrote means?!

On 11/13/09, Martin Gainty <mg...@hotmail.com> wrote:
>
> //Assuming we have this Action
> //A Simple Action Class which demonstrates placing information in a Map
> public class GetEntryAction extends ActionSupport
> {
>     private ArrayList stats_list=new ArrayList(30); //a collection of stats
>     private class stats
>     {
>       private ArrayList entries_list=new ArrayList(30); // a collection of
> Entries
>       String StatusGroupName="StatusGroupName";
>       String StatusGroupID="StatusGroupID";
>     }
>     private class Entry
>     {
>         String HOHName;
>         public String getHOH Name()
>         {
>             return HOHName;
>         }
>         public void setHOH Name(String HOHName)
>         {
>             this.HOHName=HOHName;
>         }
>         String Price;
>         public String getPrice()
>         {
>             return Price;
>         }
>         public void setPrice(String price)
>         {
>             Price=price;
>         }
>         String OriginalValue;
>         public String getOriginalValue()
>         {
>             return OriginalValue;
>         }
>         public void setOriginalValue(String str)
>         {
>             OriginalValue=str;
>         }
>     }
>     public String execute() throws Exception
>     {
>
>               Map session =
> com.opensymphony.xwork2.ActionContext.getContext().getSession();
>
>               //construct new Uber stats class
>                         stats stats1=new stats();
>                         stats1.StatusGroupName=new
> String("StatusGroupName1");
>                         stats1.StatusGroupID=new String("StatusGroupID");
>
>               //Name,Value,OriginalValue
> //construct the 1st entry
>               Entry entry1=new Entry();
>               entry1.setHOHName("ALL");
>               entry1.setPrice("50.00");
>               entry1.setOriginalValue("10.00");
> //put it into stats Map
>                         stats1.entries_list.add(entry1);
>
> //construct the second entry
>               Entry entry2=new Entry();
>               entry2.setHOHName("ALL");
>               entry2.setPrice("50.00");
>               entry2.setOriginalValue("10.00");
> //put it into entries Map
>                         stats1.entries_list.add(entry2);
>
>                         //put the stats class into stats_list
>                         stats_list.add(stats1);
>
>               //construct new Uber stats class
>                         stats stats2=new stats();
>                         stats2.StatusGroupName=new
> String("StatusGroupName2");
>                         stats2.StatusGroupID=new String("StatusGroupID2");
>
> //construct the 1st entry
>               Entry entry2a=new Entry();
>               entry2a.setHOHName("ALL");
>               entry2a.setPrice("50.00");
>               entry2a.setOriginalValue("10.00");
> //put it into stats Map
>                         stats2.entries_list.add(entry2a);
>
> //construct the second entry
>               Entry entry2b=new Entry();
>               entry2b.setHOHName("ALL");
>               entry2b.setPrice("50.00");
>               entry2b.setOriginalValue("10.00");
> //put it into entries Map
>                         stats2.entries_list.add(entry2b);
>
>                   session.put("stats_list",stats_list);
> //All of the information you require is now in the map which is now in the
> Session
>              return SUCCESS;
>     }
> }
>
> <s:iterator value="#session.stats_list" status="statsStatus"
> var="stats_list">
>      <tr class="<s:if test="#statsStatus.odd == true
> ">odd</s:if><s:else>even</s:else>">
>          <td><s:property value="name" /></td>
>          <td><s:property value="description" /></td>
>          <td>
>              <!-- notice the statsStatus.indexis used to refer to iterate
> from -->
>              <s:iterator
> value="#session.stats_list.entries_list('#statsStatus.index')"
> status="userStatus" var="user_list">
>
>                  <!-- display HOHName for anything other than 0 entry -->
>                  <s:property value="HOHName" /><s:if
> test="!#userStatus.index">,</s:if>
>
>              </s:iterator>
>          </td>
>      </tr>
>  </s:iterator>
>
> a few things to notice:
> notice how the index from statsStatus outer loop is being used for the
> session_stats inner loop
> also take a look at this List which is later pushed onto OGNLStack (session)
> private ArrayList stats_list=new ArrayList(30); //a collection of stats
> and then referenced later on as #session.stats_list
>
> once inside the session.stats_list there is a inner list
> private ArrayList entries_list=new ArrayList(30);
> which is populated and pushed onto OGNLStack (session)
> and then referenced later on as #session.stats_list.entries_list
>
>  Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>> Date: Fri, 13 Nov 2009 12:53:18 -0600
>> From: oscar.kalderon@gmail.com
>> To: user@struts.apache.org
>> Subject: Problem with <s:iterator> tag
>>
>> Hi to all, i have a simple question about <s:iterator> tag. Let's say
>> that we have a property in our action of type List, but in that list i
>> only store Strings.
>> When i want to print the value of the list on the JSP i use this code
>> snipped:
>>
>> <s:iterator value="selIngredientes">
>>     <s:property value="?" />
>> </s:iterator>
>>
>> But i don't know if that's right, because i don't know how to put in the
>> value attribute of the property tag, because the list isn't a list of
>> objects, is a list of simple strings so each object doesn't have a
>> property to get the string value.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>  		 	   		
> _________________________________________________________________
> Hotmail: Trusted email with Microsoft's powerful SPAM protection.
> http://clk.atdmt.com/GBL/go/177141664/direct/01/
> http://clk.atdmt.com/GBL/go/177141664/direct/01/
>

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


RE: Problem with tag

Posted by Martin Gainty <mg...@hotmail.com>.
//Assuming we have this Action
//A Simple Action Class which demonstrates placing information in a Map
public class GetEntryAction extends ActionSupport
{
    private ArrayList stats_list=new ArrayList(30); //a collection of stats
    private class stats
    {
      private ArrayList entries_list=new ArrayList(30); // a collection of Entries
      String StatusGroupName="StatusGroupName";
      String StatusGroupID="StatusGroupID";
    }
    private class Entry
    {
        String HOHName;
        public String getHOH Name()
        {
            return HOHName;
        }
        public void setHOH Name(String HOHName)
        {
            this.HOHName=HOHName;
        }
        String Price;
        public String getPrice()
        {
            return Price;
        }
        public void setPrice(String price)
        {
            Price=price;
        }
        String OriginalValue;
        public String getOriginalValue()
        {
            return OriginalValue;
        }
        public void setOriginalValue(String str)
        {
            OriginalValue=str;
        }
    }
    public String execute() throws Exception
    {
               
              Map session = com.opensymphony.xwork2.ActionContext.getContext().getSession();

              //construct new Uber stats class
                        stats stats1=new stats();
                        stats1.StatusGroupName=new String("StatusGroupName1");
                        stats1.StatusGroupID=new String("StatusGroupID");
              
              //Name,Value,OriginalValue
//construct the 1st entry
              Entry entry1=new Entry();
              entry1.setHOHName("ALL");
              entry1.setPrice("50.00");
              entry1.setOriginalValue("10.00");   
//put it into stats Map
                        stats1.entries_list.add(entry1);

//construct the second entry
              Entry entry2=new Entry();
              entry2.setHOHName("ALL");
              entry2.setPrice("50.00");
              entry2.setOriginalValue("10.00");   
//put it into entries Map
                        stats1.entries_list.add(entry2);

                        //put the stats class into stats_list
                        stats_list.add(stats1);

              //construct new Uber stats class
                        stats stats2=new stats();
                        stats2.StatusGroupName=new String("StatusGroupName2");
                        stats2.StatusGroupID=new String("StatusGroupID2");
                                  
//construct the 1st entry
              Entry entry2a=new Entry();
              entry2a.setHOHName("ALL");
              entry2a.setPrice("50.00");
              entry2a.setOriginalValue("10.00");   
//put it into stats Map
                        stats2.entries_list.add(entry2a);

//construct the second entry
              Entry entry2b=new Entry();
              entry2b.setHOHName("ALL");
              entry2b.setPrice("50.00");
              entry2b.setOriginalValue("10.00");   
//put it into entries Map
                        stats2.entries_list.add(entry2b);

                  session.put("stats_list",stats_list);
//All of the information you require is now in the map which is now in the Session
             return SUCCESS;
    }
}

<s:iterator value="#session.stats_list" status="statsStatus" var="stats_list">
     <tr class="<s:if test="#statsStatus.odd == true ">odd</s:if><s:else>even</s:else>">
         <td><s:property value="name" /></td>
         <td><s:property value="description" /></td>
         <td>
             <!-- notice the statsStatus.indexis used to refer to iterate from -->
             <s:iterator value="#session.stats_list.entries_list('#statsStatus.index')" status="userStatus" var="user_list">

                 <!-- display HOHName for anything other than 0 entry --> 
                 <s:property value="HOHName" /><s:if test="!#userStatus.index">,</s:if>

             </s:iterator>
         </td>
     </tr>
 </s:iterator>

a few things to notice:
notice how the index from statsStatus outer loop is being used for the session_stats inner loop
also take a look at this List which is later pushed onto OGNLStack (session) 
private ArrayList stats_list=new ArrayList(30); //a collection of stats
and then referenced later on as #session.stats_list

once inside the session.stats_list there is a inner list
private ArrayList entries_list=new ArrayList(30);
which is populated and pushed onto OGNLStack (session)
and then referenced later on as #session.stats_list.entries_list

 Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Fri, 13 Nov 2009 12:53:18 -0600
> From: oscar.kalderon@gmail.com
> To: user@struts.apache.org
> Subject: Problem with <s:iterator> tag
> 
> Hi to all, i have a simple question about <s:iterator> tag. Let's say 
> that we have a property in our action of type List, but in that list i 
> only store Strings.
> When i want to print the value of the list on the JSP i use this code 
> snipped:
> 
> <s:iterator value="selIngredientes">
>     <s:property value="?" />
> </s:iterator>
> 
> But i don't know if that's right, because i don't know how to put in the 
> value attribute of the property tag, because the list isn't a list of 
> objects, is a list of simple strings so each object doesn't have a 
> property to get the string value.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with Microsoft's powerful SPAM protection.
http://clk.atdmt.com/GBL/go/177141664/direct/01/
http://clk.atdmt.com/GBL/go/177141664/direct/01/