Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Setting Map values using JSTL

800345Apr 2 2004 — edited Apr 16 2004
Hey all, not sure if I am doing this right (haven't been able to test it...)

But I think you can instantiate a HashMap with the jsp:useBean:
<jsp:useBean id="monthNames" scope="session">
Then You can fill it in between the opening tag there and the closing tag (in this case, so it will only be filled once for each session...).

The question is, for maps, do I use:
    <jsp:setProperty name="monthNames" property="1" value="January"/> 
or would I use the JSTL c:set:
    <c:set var="${monthNames.1}" value="January"/>
I am reasonably sure that <c:set var"someVar" value="monthNames.1"> would assign the value of monthNames.get("1") to someVar, but I am not sure if you can put the EL on the opposite side and have it be the equivalent of monthNames.put("1", "January");

Any ideas or should I just use the <% %> tag thingies?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 14 2004
Added on Apr 2 2004
9 comments
1,578 views