Rick,

Did you see my previous reply?

http://marc.theaimsgroup.com/?l=taglibs-user&m=105840665117009

Using an Integer as a key works fine as long as you've already got it as a
scoped attribute. I just can't see any way to "construct" a key that will work
using literals. So, in your example, if "currentLaborReportLevel" is a scoped
attribute of type Integer and "mapOfLaborReports" is a scoped attribute of type
Map with Integer keys, then "${mapOfLaborReports[currentLaborReportLevel]}"
should work. Are you getting any exceptions or just no output? Have you dumped
out both currentLaborReportLevel and mapOfLaborReports to make sure they really
contain what you expect?

Quoting Rick Reumann <[EMAIL PROTECTED]>:

> On Thu, 2003-07-17 at 09:56, Michael Duffy wrote:
>  
> > The java.util.Map only takes Objects as keys and
> > values.  If you've got an int that you want to use as
> > the key to get a value out of your Map, you'll have to
> > wrap it as a java.lang.Integer first.
> 
> I understand that:) What in my e-mail led you to think I was trying to
> use an int vs Integer?
>  
> > 
> > <c:out value="Here's the value you ordered:
> > ${users.get[key]}"/>
> > 
> > But it's not working.  Unless the EL can handle
> > passing an Object to a Map, I don't know a way to do
> > what you're asking.  The int-to-String is the only
> > workaround that I'm aware of. - MOD
> 
> Ok, that's what I wanted to know (and what I was afraid of:).
> 
> I guess if I really cared I could modify the tag to an additional
> parameter such as class-type so I can let the tag know whether the key
> to be looked up should be cast to an Integer from the String
> representation that is being passed to the tag evaluation.
> 
> -- 
> Rick

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to