You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Daniel Rogers <ii...@ccwf.cc.utexas.edu> on 2001/12/10 21:17:32 UTC

Re: Static methods

On Mon, Dec 10, 2001 at 11:11:22AM -0500, Sonnathi, Venkat Ramana wrote:
> Hi,
> 
> Can I place a Class object into context and then invoke static methods of
> the class?
> ...
> I am doing this in my Servlet:
> 
>         ctx.put( "classtool", ClassTool.class);

Have you tried: ctx.put( "classtool", new ClassTool() );

Daniel

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Static methods

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/10/01 3:17 PM, "Daniel Rogers" <ii...@ccwf.cc.utexas.edu> wrote:

> On Mon, Dec 10, 2001 at 11:11:22AM -0500, Sonnathi, Venkat Ramana wrote:
>> Hi,
>> 
>> Can I place a Class object into context and then invoke static methods of
>> the class?
>> ...
>> I am doing this in my Servlet:
>> 
>>         ctx.put( "classtool", ClassTool.class);
> 
> Have you tried: ctx.put( "classtool", new ClassTool() );
> 

Yes, you should put an instance of the class in the context, and then use
that to get at the static methods...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>