velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Lau <vw...@pacbell.net>
Subject Re: double rendering
Date Sat, 06 Jul 2002 21:34:40 GMT
Related to this subject.  Although I know it works by experiments, I would like
to get some expert opinion whether it is safe (in future Velocity releases)
to pass the same Writer object for recursive rendering? For example,

public void render( Writer writer, String v )
{
	if (some condition)
		return;
	...
	ctx.put("writer", writer);
	ctx.put("obj", this);
	ctx.put("value", v);
	template.merge(ctx, writer);
}

And the template contains

$obj.render($writer, $value)

-Vincent

>> Hi,
>> 
>>   I am using a velocimacro to create some dhtml with a java class :
>> 
>> #macro ( menu $m)
>> 
>>   $m.getHtml()
>> 
>> #end
>> 
>> and would like the String returned to again be rendered by the velocity
>> engine, as my java class writes some references that I need eval'd at
>> run-time.
>> 
>> Is this possible?  I saw the #parse command, but that seems to be just for
>> files, and I don't want to have to write the String to a file.
>> 
>> Thanks to anyone who can help.

>The usual approach is to make a little tool that allows you to use the
>Velocity.evaluate() method to render.

>I need to take some time off for Velocity catch-up - I'll make a little eval
>tool and  #eval() directive and put in contrib...



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


Mime
View raw message