velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "THOMAS, BRIAN M \(SBCSI\)" <bt0...@att.com>
Subject RE: Acccessing static member-vars
Date Tue, 11 Apr 2006 17:32:25 GMT
I've actually done it using vanilla Java reflection.  It's ugly, to be
sure...

Something like

   $Permission.class.getField("P_SHOWBOARD").int

in your case.

brain[sic] 

-----Original Message-----
From: Geir Magnusson Jr [mailto:geir@pobox.com] 
Sent: Tuesday, April 11, 2006 9:01 AM
To: Velocity Users List
Subject: Re: Acccessing static member-vars


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


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


Mime
View raw message