You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Knoernschild, Kirk W" <KK...@amfam.com> on 2002/09/17 22:46:43 UTC

Bean with HashMap in JSP

All,

I have a display bean that has within it a variable of type HashMap.  >From within the JSP, instead of iterating over the values of the HashMap, I *need* to access the individual values based on the key. Anyone have any pointers on how to do this?

I'm using STRUTS v1.0.

thanx.

kirk

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Bean with HashMap in JSP

Posted by Eddie Bush <ek...@swbell.net>.
Go with standards - use the JSTL.  It's easy, it's standard ... and it 
keeps you away from scriplets (which are just *evil* I tell you ... *evil*!)

You can get the JSTL at http://jakarta.apache.org/taglibs
    - Select "JSTL" or "Standard" taglib from left (it's toward the top 
- easy to spot)
        - You'll find a link to download the JSTL.  Click it.
        - unpack the distribution and copy the required files to your 
application
    - Find the link regarding Sun's JSTL site and go there
        - Bookmark this page
        - There's a really good refrerence PDF here - you might want to 
snag a copy
        - There are (I think) 3 articles which go over using the JSTL 
here that are useful to get you started
    - You may be interested in an EL-enabled version of the struts taglibs
        - Go to http://issues.apache.org/bugzilla/show_bug.cgi?id=12365
        - Scroll down to the bottom
        - Click the link that says "created an attachment (id=2954)"
        - Save it as struts-el.tar.gz
        - unpack (tar xzf struts-el.tar.gz)
        - cd struts-el
        - edit build.properties to fit your environment
        - mkdir conf/share
        - ant
        - cp target/library/struts-el.jar /path/to/your/WEB-INF/lib
        - cp target/library/struts-*-el.tld /path/to/your/WEB-INF
    = You're setup for using the JSTL and have EL-enabled Struts tags. 
 Enjoy.

Knoernschild, Kirk W wrote:

>All,
>
>I have a display bean that has within it a variable of type HashMap.  >From within the JSP, instead of iterating over the values of the HashMap, I *need* to access the individual values based on the key. Anyone have any pointers on how to do this?
>
>I'm using STRUTS v1.0.
>
>thanx.
>
>kirk
>
-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>