You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Wendy Smoak <We...@asu.edu> on 2003/12/11 16:21:36 UTC

Constructing key to an object in session scope

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 error occurred while evaluating
custom action attribute "items" with value
"${accountForm.map['year']+'accounts'}": An exception occured trying to
convert String "accounts" to type "java.lang.Long"

How can I convince it that '2002' is just a String?  I've tried other
variations, and sometimes it complains about a Double instead of a Long.

I tried flipping the order so it's 'accounts2002' but I got the same
error.  I bet this is very simple and I'm just not awake yet...

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 



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


Re: Constructing key to an object in session scope

Posted by Kris Schneider <kr...@dotech.com>.
Maybe:

<c:set var="mapName" value="${year}account"/>
<c:forEach var="account" items="${sessionScope[mapName]}">
...

Quoting Wendy Smoak <We...@asu.edu>:

> 
> 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 error occurred while evaluating
> custom action attribute "items" with value
> "${accountForm.map['year']+'accounts'}": An exception occured trying to
> convert String "accounts" to type "java.lang.Long"
> 
> How can I convince it that '2002' is just a String?  I've tried other
> variations, and sometimes it complains about a Double instead of a Long.
> 
> I tried flipping the order so it's 'accounts2002' but I got the same
> error.  I bet this is very simple and I'm just not awake yet...
> 
> -- 
> Wendy Smoak
> Application Systems Analyst, Sr.
> ASU IA Information Resources Management 

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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