Oh, and to be specific, the FieldTool is for public static fields.  If
you wish to access static fields with other permissions, you will have
to use the ClassTool with safeMode=false.

On Feb 8, 2008 7:51 AM, Nathan Bubna <[EMAIL PROTECTED]> wrote:
> Even simpler than the ClassTool or writing your own is the new FieldTool:
>
> http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/FieldTool.html
>
> Which is made precisely for easy access to static fields in such a
> class as MyConstants!  You'll see in the examples at the link above
> that the name of one of the example classes. :)
>
>
> On Feb 8, 2008 6:55 AM, Claude Brisson <[EMAIL PROTECTED]> wrote:
> > You cannot directly read static fields, however since you are apparently
> > using a toolbox you can easily wrap the class that contains static
> > fields in a custom tool (that uses java reflection), and possibly look
> > at the code from the -not yet released- ClassTool which doesn't exist in
> > VelocityTools 1.4.x, only in 2.x. Quite easy to backport, you would
> > typically just inherit the protected constructor that specify the class
> > to inspect. Ask here if you encounter any problem doing so.
> >
> >
> >   Claude
> >
> > Nobody seems to understand what I say these days... Is it me or what?!
> >
> >
> > Le vendredi 08 février 2008 à 17:52 +0530, Manish a écrit :
> >
> > > Can you give me link of the specific text in user guide that says you can 
> > > read
> > > static - I couldn't find it!
> > >
> > > TIA,
> > > - Manish
> > >
> > > ----- Original Message -----
> > > From: "Claude Brisson" <[EMAIL PROTECTED]>
> > > To: "Velocity Users List" <[email protected]>
> > > Sent: Friday, February 08, 2008 5:45 PM
> > > Subject: Re: Using static string in Velocity
> > >
> > >
> > > > What you have read is true, nevertheless it's very easy to write a tool
> > > > wrapping your class, and such a tool does already exist in VelocityTools
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to