You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jo...@reasoning.com on 2002/08/23 19:29:43 UTC
Docs on Java classes for VelocityContexts
Is there documentation on the Java class forms that are understood by
Velocity?
For example:
public class Foo { public String bar ; }
Foo foo ;
context.put("foo",foo) ;
$foo.bar
I thought that last line would work in a Velocity template, but it does
not.
On the other hand, if I add "public String getBar() { return bar ; }" to
the
class, then it does. Is there someplace in the documentation were these
rules (getVariable method is visible, but plain old variable is not) are
listed?
Joshua Levy
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Docs on Java classes for VelocityContexts
Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 8/23/02 1:29 PM, "Joshua.Levy@reasoning.com" <Jo...@reasoning.com>
wrote:
>
>
> Is there documentation on the Java class forms that are understood by
> Velocity?
>
> For example:
> public class Foo { public String bar ; }
>
> Foo foo ;
> context.put("foo",foo) ;
>
> $foo.bar
>
> I thought that last line would work in a Velocity template, but it does
> not.
No - Velocity won't introspect for public members of the class, only invoke
methods.
> On the other hand, if I add "public String getBar() { return bar ; }" to
> the
> class, then it does. Is there someplace in the documentation were these
> rules (getVariable method is visible, but plain old variable is not) are
> listed?
Probably not. There as a recent contrib to the list that I was going to
work into the docs - that should be added to it.
--
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>