Hi,
there is a RenderTool in the velocity tools subproject that you can reuse to do the Velocity.evalute(...) for you.
Cheers, Christoph
Kris Nuttycombe wrote:
So, just to clarify, the tool I put into the context will invoke Velocity.evaluate(...) on the string containing the new macro? And I'll use a simple template that just looks like:
$mytool.register()
and merge that template?
Thanks for your help. It seems a little strange that there's not a method to load a template directly from a string rather than from some ResourceLoader. I guess that this is what Velocity.evaluate(...) is there for, but it doesn't make sense to have to regenerate the parse tree for the template each time since I need to merge the template as many as 10,000 times with different data in the context, and I can't just stick it all in a list and use #foreach because creating the list causes OutOfMemoryErrors.
Kris
Geir Magnusson Jr wrote:
On Jun 25, 2004, at 10:43 AM, Kris Nuttycombe wrote:
Hello,
Is there any way to register a dynamically generated Velocimacro? I found the Velocity.invokeVelocimacro(...) method by looking at the javadocs, and it looks like precisely what I need except for the fact that I'm dynamically generating the vtml for the velocimacro and haven't been able to figure out how to register it.
Any suggestions?
My canonical one - put a tool in the context that allows you to merge template on a string. Then put the dynamically generated macro in a string and just merge it. That will register it.
geir
===================================================== Kris Nuttycombe Associate Scientist Geospatial Data Services Group CIRES, National Geophysical Data Center/NOAA (303) 497-6337 [EMAIL PROTECTED]
Every problem has an elegant solution. If you cannot conceive of an elegant solution, you have not yet correctly understood the problem. =====================================================
--------------------------------------------------------------------- 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]
