just ignore him, he is a resident troll. On Sat, Nov 14, 2009 at 6:07 PM, Burton Rhodes <burtonrho...@gmail.com> wrote: > I habe no idea what Martin just wrote means?! > > On 11/13/09, Martin Gainty <mgai...@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.kalde...@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-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
--------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org