hello all,
I'm new to velocity, and I'm trying to get something general to work for
different kinds of inputs + templates.
I'm doing something like:
*******************
class Velo {
public static StringList [] stringlist;
public static void main(String[] args)
{
Velo v = new Velo();
v.run(args);
}
public void run (String[] args)
{
...fill stringlists with data ...
... initialise velocity ...
for (i = 0; i < ... ; i++)
context.put(el_name[i], stringlist[i].sl);
...
}
}
***********************************
public class StringList
{
public String name;
public StringRow [] sl;
public StringList()
{
name = "";
... initialse stringrows ...
}
}
************************************
public class StringRow
{
public String N;
public ArrayList <String> sr;
public StringRow()
{
sr = new ArrayList <String> ();
}
public String getN()
{
return N;
}
}
************************************
but when running the template entry
#foreach( $res in $result )
<td> ${res}.getN() </td>
#end
I'm only getting
<td> [email protected]() </td>
= the method getN() isn't being translated in to the underlying String
so my questions are :-)
1. why won't this work?
2. can something like <td> ${res}.sr.get(0) </td> work?
i.e. calling a method (= get(0)) on a field (sr) of the context
element (${res}) that is actually an array?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]