velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: Overriding the default precedence of the template engine
Date Thu, 20 Jul 2006 16:52:57 GMT
Yeah, actually, you can do this, but it'll take a wee bit o' work.  We
do something like this in VelocityTools to prevent templates from
overriding tool references.

You need to create and use your own custom Context that puts your
higher priority values in a different internal map than values set in
the template.   Then when a get() is called on it, you need to have it
check the non-template modified map first.  This is a rushed
explanation, but i hope it points you in the right direction.  I may
have time to help more later if you can't figure it out.

On 7/20/06, Smith, Mike H <Mike.H.Smith@pfizer.com> wrote:
> Hi,
>
>
>
> Is there a way to modify the precedence logic of the template engine?
>
>
>
> In particular, I'd like to:
>
>
>
>
>
> 1.      Define a template like:
>
>
>
> #set( $this = "Velocity")
>
> $this is great!
>
>
>
> 2.      Within the application code, set the "this" property to be
> something different (e.g. "Laughter")
> 3.      Then have the engine render as "Laughter is great"
>
>
>
>
>
> With the current implementation the rendering precedence is template
> then context, any easy way to reverse this?
>
>
>
> Thanks.
>
> Mike
>
>
>
>
>
>
>
>
>

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


Mime
View raw message