cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hugo Burm" <hu...@xs4all.nl>
Subject RE: accessing a HashMap from JXTemplate
Date Sun, 10 Aug 2003 08:56:00 GMT


It took me some time to find out how you can iterate over a map in jxpath:

   <c:forEach  select="#{values(/units)}">
      #{./id} <br/>
   </c:forEach>


/units is a map of unit objects.
You can call a java function on a java object by giving the instance as the
first parameter. So I am calling the java values() function on my /units map
which creates a collection of its values.
#{./id} prints the id field of each of my unit objects.

The jexl syntax works without conversion:

   <c:forEach  var="item" items="${mapU}">
	${item.getId()} <br/>
   </c:forEach>


Hugo

> -----Original Message-----
> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
> Sent: Friday, August 08, 2003 9:47 PM
> To: dev@cocoon.apache.org
> Subject: accessing a HashMap from JXTemplate
>
>

> but it does not output anything, so I tried this :
>
> <t:forEach items="#{form/errors}">
> 	<tr valign="top">
> 		<td>#{name()}</td>
> 		<td>#{.}</td>
> 	</tr>
> </t:forEach>
>
> but got unexpected results :
>
>


Mime
View raw message