You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by danny van elsen <da...@skynet.be> on 2010/02/15 22:54:13 UTC
[Fwd: Re: classes + methods]
ok, given
public class StringRow
{
public String N;
public ArrayList <String> sr;
public StringRow(Integer i)
{
sr = new ArrayList <String> ();
N = "heej" + Integer.toString(i) ;
}
public String getsr(Integer i)
{
return sr.get(i);
}
public String getN()
{
return N;
}
}
and the template
#foreach( $res in $result )
-hallo-
<td> {$res}.size() </td>
<td> $res.N </td>
#end
I now get
-hallo-
<td> {velsd.StringRow@7854a328}.size() </td>
<td> heej01 </td>
-hallo-
<td> {velsd.StringRow@7ca3d4cf}.size() </td>
<td> heej02 </td>
and so on
is there any way that the $res in
#foreach( $res in $result )
can itself refer to a new array?
reading the documentation, I was led to believe that this array could be
a ArrayList, but perhaps it has to be a fixed size array?
greetings, danny.
On Sat, 2010-02-13 at 15:34 -0700, ChadDavis wrote:
> Those braces go around everything in the velocity reference.
>
> ${res}.getN()
>
> should be
>
> ${res.getN()}
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org