tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gideon, Thomas" <Thomas.Gid...@B2eMarkets.com>
Subject RE: JSTL and HashMap: How does it work?
Date Wed, 09 Oct 2002 18:53:09 GMT
Doesn't matter, the JSTL spec says that the iteration tags should work with
Maps, as well as arrays and instances of the Collection interface.

Thomas Gideon
Sr. Software Developer
B2eMarkets

301.230.2236  Tel.
301.230.2248  Fax.
thomas.gideon@B2eMarkets.com
www.B2eMarkets.com



> -----Original Message-----
> From: Roberto Mannai [mailto:roberto.mannai@poste.it]
> Sent: Wednesday, October 09, 2002 2:26 PM
> To: Tag Libraries Users List
> Subject: Re: JSTL and HashMap: How does it work?
> 
> 
> I don't know JSTL, but Hashmap does not implement
> Collection interface.
> Regards,
> Roberto
> 
> ----- Original Message -----
> From: <Eric.Lewis@swissinfo.ch>
> To: <taglibs-user@jakarta.apache.org>
> Sent: Wednesday, October 09, 2002 8:02 PM
> 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:taglibs-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:taglibs-user-help@jakarta.apache.org>
> >
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:taglibs-user-help@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message