Nope, you can do it. From the spec: <%-- “productDir” is a Map object containing the description of products, “preferences” is a Map object containing the preferences of a user --%> product: <c:out value=”${productDir[product.custId]}”/> shipping preference: <c:out value=’${user.preferences[“shipping”]}’/>
Using "." notation should work as well: user.preferences.shipping Quoting [EMAIL PROTECTED]: > Ok, that works - thanks a lot! > So, if I understand this right, it's not possible to directly address > something with the key? You have to go through the whole collection, right? > > Regards, > Eric > > -----Original Message----- > From: Gideon, Thomas [mailto:[EMAIL PROTECTED]] > Sent: Mittwoch, 9. Oktober 2002 20:58 > To: 'Tag Libraries Users List' > Subject: RE: JSTL and HashMap: How does it work? > > > With a Map in the <c:forEach/> tag, you need to de-reference the value > explicitly in your EL in the nested <c:out/>, like so: > > stock.numberOfCharts = <c:out value="${stock.numberOfCharts}"/><br> > stock.charts = <c:out value="${stock.charts}"/> > <c:forEach var="chart" items="${stock.charts}"> > <br>-> chart = <c:out value="${chart.value}"/> > //-----------------------------------------^^^^^ > </c:forEach> > > The <c:forEach/> tag gets a Set by calling the entrySet() method of the > Map, > then iterates over that. The Set contains Map.Entry instances which define > getKey() and getValue() methods which can be accessed in the usual way, as > Java Bean properties, in EL. > > Thomas Gideon > Sr. Software Developer > B2eMarkets > > 301.230.2236 Tel. > 301.230.2248 Fax. > [EMAIL PROTECTED] > www.B2eMarkets.com > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, October 09, 2002 2:03 PM > > To: [EMAIL PROTECTED] > > Subject: JSTL and HashMap: How does it work? > > > > > > Hi all > > > > According to the documentation, it's possible to get data > > from a HashMap in > > JSTL. Unfortunately, it doesn't really work for me... > > > > Here's the deal: A stock has a collection of charts, thus: > > > > stock.numberOfCharts = <c:out value="${stock.numberOfCharts}"/><br> > > stock.charts = <c:out value="${stock.charts}"/> > > <c:forEach var="chart" items="${stock.charts}"> > > <br>-> chart = <c:out value="${chart}"/> > > </c:forEach> > > > > results in > > > > stock.numberOfCharts = 9 > > stock.charts = > > {1M=ch.xobix.contentgroup.controller.ImageWrapper@f6ae1c, > > 2M=ch.xobix.contentgroup.controller.ImageWrapper@20d6b7, > > 3M=ch.xobix.contentgroup.controller.ImageWrapper@f08d0f, > > 6M=ch.xobix.contentgroup.controller.ImageWrapper@bcfa38, > > 1Y=ch.xobix.contentgroup.controller.ImageWrapper@cfaf6e, > > 2Y=ch.xobix.contentgroup.controller.ImageWrapper@6989e, > > 3Y=ch.xobix.contentgroup.controller.ImageWrapper@dd7a7, > > 5Y=ch.xobix.contentgroup.controller.ImageWrapper@c94114, > > YTD=ch.xobix.contentgroup.controller.ImageWrapper@cf9bf0} > > -> chart = 1M=ch.xobix.contentgroup.controller.ImageWrapper@f6ae1c > > -> chart = 2M=ch.xobix.contentgroup.controller.ImageWrapper@20d6b7 > > -> chart = 3M=ch.xobix.contentgroup.controller.ImageWrapper@f08d0f > > -> chart = 6M=ch.xobix.contentgroup.controller.ImageWrapper@bcfa38 > > -> chart = 1Y=ch.xobix.contentgroup.controller.ImageWrapper@cfaf6e > > -> chart = 2Y=ch.xobix.contentgroup.controller.ImageWrapper@6989e > > -> chart = 3Y=ch.xobix.contentgroup.controller.ImageWrapper@dd7a7 > > -> chart = 5Y=ch.xobix.contentgroup.controller.ImageWrapper@c94114 > > -> chart = YTD=ch.xobix.contentgroup.controller.ImageWrapper@cf9bf0 > > > > which is fine. However, how can I address one entry? > > If I try > > > > chart = <c:out value="${stock.charts["1M"]}"/> > > > > I get > > > > javax.servlet.ServletException: > > /jsp/financialdata/show.jsp(33,40) Attribute > > 1M has no value > > > > By the way, my getCharts() returns a LinkedHashMap (I wanted the same > > sequence as when I inserted the objects). Theoretically, > > shouldn't I be able > > to traverse it like e.g. an ArrayList? > > > > chart[0] = <c:out value="${stock.charts[0]}"/> > > > > doesn't give me anything, though... > > > > > > Best regards, > > Eric > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>