velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: Referencing arrays
Date Mon, 15 Nov 2004 22:38:06 GMT
Hi Steve,

> I'm trying to reference a 2 dimensional array of strings using the following
> :-
> 
> #if ($Results)
>    <table width="100%" border="0" cellpadding="2" cellspacing="0">
>        #foreach ($Label in $Labels)
>        <tr>
>            <td valign="top">$!Label&nbsp;</a></td>
>            <td valign="top">$Results[0][$velocityCount]</td>
>        </tr>
>        #end
>    </table>
> #end
> 
> Unfortunately I just get [[Ljava.lang.String;@1684e26[0][x] where x is the
> $velocityCount.
> 
> Anyone know how to get this to work?
AOTM, you can't.
What you _can_ do is:
1. Put the Label and Result in a JavaBean and iterate through an
array/List of that.
2. Use ArrayTool.  :)
   http://wiki.apache.org/jakarta-velocity/ArrayTool

I prefer #1.

Best regards,
-- Shinobu Kawai

-- 
Shinobu Kawai <shinobu.kawai@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message