Constructing key to an object in session scope

2003-12-11 Thread Wendy Smoak
In a Struts Action, I place a Map in session scope depending on what year the user has chosen-- there may be Maps there named 2002accounts, 2001accounts, etc. Now to display the contents of the Map, I tried: c:forEach items=${year+'accounts'} var=account org.apache.jasper.JasperException: An

Re: Constructing key to an object in session scope

2003-12-11 Thread Kris Schneider
Maybe: c:set var=mapName value=${year}account/ c:forEach var=account items=${sessionScope[mapName]} ... Quoting Wendy Smoak [EMAIL PROTECTED]: In a Struts Action, I place a Map in session scope depending on what year the user has chosen-- there may be Maps there named 2002accounts,

RE: Constructing key to an object in session scope

2003-12-11 Thread Wendy Smoak
From: Kris Schneider [mailto:[EMAIL PROTECTED] c:set var=mapName value=${year}account/ c:forEach var=account items=${sessionScope[mapName]} Thanks for jogging my memory... You can construct the key, but you lose the ability to magically find it in any scope, you have to specify where it

RE: Constructing key to an object in session scope

2003-12-11 Thread Kris Schneider
Another approach would be to maintain a map of maps (keyed by year) instead of multiple free standing maps. Something like: accountMap: {2001={...}, 2002={...}, ...} So your loop might look like: c:forEach var=account items=${accountMap[year]} ... Quoting Wendy Smoak [EMAIL PROTECTED]:

RE: Constructing key to an object in session scope

2003-12-11 Thread Wendy Smoak
From: Kris Schneider [mailto:[EMAIL PROTECTED] Another approach would be to maintain a map of maps (keyed by year) instead of multiple free standing maps. Something like: Clever! Job security in a single line: c:forEach items=${accountMap[accountForm.map['year']]} var=account -- Wendy

RE: Constructing key to an object in session scope

2003-12-11 Thread Kris Schneider
;-) I hate to make it more readable, but you should be able to do: c:forEach items=${accountMap[accountForm.map.year]} var=account Quoting Wendy Smoak [EMAIL PROTECTED]: From: Kris Schneider [mailto:[EMAIL PROTECTED] Another approach would be to maintain a map of maps (keyed by year)