Problem using dynamic variable as HashMap key



I have created a HashMap called instantHashMap and loaded it with data from
a query .

I can load a variable with an explicit value for the HashMap key and
successfully output the HashMap value:

<c:set var = "gameno" value="2" />
<c:out value = "${instantHashMap[gameno]}" />

But when I load my variable value from my data like this...

<c:set var = "gameno" value="${rvo.gameNo}" />
<c:out value = "${instantHashMap[gameno]}" />

....it doesn't work.

My loaded variable value is correct because this statement does work and
reflects the data obtained from my query:

<c:out value = "${gameno}" />

I have determined that the hashmap key must be a string because if I change
the original statement

<c:set var = "gameno" value="2" />

to

<c:set var = "gameno" value="${ 1 + 1 }" />

this statement

<c:out value = "${gameno}" />

prints a 2, but the statatement

<c:out value = "${instantHashMap[gameno]}" />

now fails.

The database data type of my gameno field is varchar, so Java should see it
as a string.

What am I doing wrong?
.



Relevant Pages

  • Text parsing and substitution
    ... parse the line, ... load a hashmap with the key, ... I was thinking this sort of logic but a little apprehensive how elastic ...
    (comp.lang.perl.misc)
  • problem when try to store xmldom into hashmap
    ... ANd i call loadxml many times to load different xml string and each time i ... store m_pDocPtr ... in to hashmap as value with some key say number.. ...
    (microsoft.public.vc.mfc)
  • problem when try to store xmldom into hashmap
    ... ANd i call loadxml many times to load different xml string and each time i ... store m_pDocPtr ... in to hashmap as value with some key say number.. ...
    (microsoft.public.vc.stl)
  • problem when try to store xmldom into hashmap
    ... ANd i call loadxml many times to load different xml string and each time i ... store m_pDocPtr ... in to hashmap as value with some key say number.. ...
    (microsoft.public.win32.programmer.ole)
  • Re: HashMap Capacity Argument.
    ... You can back this out from the load factor. ... purposes of this post, represents the maximum percentage of the ... capacity of the HashMap that may be populated. ...
    (comp.lang.java.help)