You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Dominik Bruhn <do...@dbruhn.de> on 2006/04/11 15:49:31 UTC

Acccessing static member-vars

Hy,
I got the following Class:
=========
public class Permission {
	public static int P_SHOWBOARD=0;
	public static int P_CREATETHREAD=1;
	public static int P_REPLY=2;
}
=========

How can I Access these Properties in a Velocity-Template.

I tried:
context.put("Permission",Permission.class);

and
<h1>$Permission.PERM_SHOWBOARD</h1>

But this didn't work.

How can help?

Thanks
TO

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


Re: Acccessing static member-vars

Posted by Geir Magnusson Jr <ge...@pobox.com>.
right now, Velocity doesn't allow field access, static or otherwise.

There is a tool/wrapper somewhere called the FieldMethodizer which *may* 
allow static access...

geir

Dominik Bruhn wrote:
> Hy,
> I got the following Class:
> =========
> public class Permission {
> 	public static int P_SHOWBOARD=0;
> 	public static int P_CREATETHREAD=1;
> 	public static int P_REPLY=2;
> }
> =========
> 
> How can I Access these Properties in a Velocity-Template.
> 
> I tried:
> context.put("Permission",Permission.class);
> 
> and
> <h1>$Permission.PERM_SHOWBOARD</h1>
> 
> But this didn't work.
> 
> How can help?
> 
> Thanks
> TO
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 

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