You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Pawel Sasor <pa...@faustit.com> on 2004/09/22 10:54:38 UTC
RenderTool -- what is null ?
hi!
I'm trying to use RenderTool in my app. I do the following:
in java code:
.........
public final static String CONTEXT_ATTRIBUTE = "ctx";
public final static String RENDER_TOOL_ATTRIBUTE = "render";
.........
velocityContext.put(CONTEXT_ATTRIBUTE, velocityContext);
velocityContext.put(RENDER_TOOL_ATTRIBUTE, new RenderTool());
.........
in template:
#set( $aaa = "abc" )
$render.eval( $ctx, "$aaa" )
I get this:
org.apache.velocity.exception.MethodInvocationException: Invocation of
method 'eval' in class org.apache.velocity.tools.generic.RenderTool
threw exception class java.lang.NullPointerException : null
why? :)
best wishes
pawel
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: RenderTool -- what is null ?
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi pawel,
> I slightly modified the RenderTool so that it works well in the separate
> instance model. :)
Could you submit a patch to bugzilla? I'll bet it would make us all happy. :-)
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai(shinobu.kawai@gmail.com)
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: RenderTool -- what is null ?
Posted by Pawel Sasor <pa...@faustit.com>.
On Wed, 2004-09-22 at 16:36, Shinobu Kawai wrote:
> How are you calling Velocity? Are you by any chance using
> VelocityEngine? If so, RenderTool won't work.
> cf. http://issues.apache.org/bugzilla/show_bug.cgi?id=31287
many thanks Shinobu!!!
that was exactly the problem I had!
I use SpringFramework and there the velocity engine is initialized
magically as a separate instance.
I slightly modified the RenderTool so that it works well in the separate
instance model. :)
thanks a lot for help!!!
pawel
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: RenderTool -- what is null ?
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi pawel,
> I'm trying to use RenderTool in my app. I do the following:
>
> in java code:
> .........
> public final static String CONTEXT_ATTRIBUTE = "ctx";
> public final static String RENDER_TOOL_ATTRIBUTE = "render";
> .........
> velocityContext.put(CONTEXT_ATTRIBUTE, velocityContext);
> velocityContext.put(RENDER_TOOL_ATTRIBUTE, new RenderTool());
> .........
>
> in template:
> #set( $aaa = "abc" )
> $render.eval( $ctx, "$aaa" )
>
> I get this:
>
> org.apache.velocity.exception.MethodInvocationException: Invocation of
> method 'eval' in class org.apache.velocity.tools.generic.RenderTool
> threw exception class java.lang.NullPointerException : null
How are you calling Velocity? Are you by any chance using
VelocityEngine? If so, RenderTool won't work.
cf. http://issues.apache.org/bugzilla/show_bug.cgi?id=31287
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai(shinobu.kawai@gmail.com)
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org