You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Simon Whitworth <si...@whitworth.com> on 2004/10/10 01:36:52 UTC

Newbie 2D array question

I have a question regarding formatting a vector list and a 2 dimensional
array in a table. I have done a lot of searching on the web and in the
archive and have come up empty handed.

Here is a simple example of what I'm trying to achieve ..

In my servlet I have a vector, called names, containing 3 names ["Tom",
"Dick", "Harry"]

I also have a 3x3 array of ints, called points, containing the following
data :

[11, 12, 13] 
[21, 22, 23] 
[31, 32, 33]

I am trying to construct a velocity template to display the names and points
in the following format :

Tom   11  12  13
Dick  21  22  23
Harry 31  32  33

I have wrestled with various flavours of nested #foreach statements, but I'm
not having a lot of success.

Any guidance on how I should be approaching this would be very much
appreciated.

Also, is there any other recommended documentation for Velocity apart from
the user guide and reference manual on the apache website ?

Thanks,
Simon.