You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by bi...@ubs.com on 2005/06/23 17:07:44 UTC

How to access velocity properties in template

I want to reference entries in velocity.properties in a template. For
example, I'd like the template:

Max depth is $directive.parse.max.depth

to produce

Max depth is 10

I've tried a number of variations ( $parse.max.depth,
$org.apache.velocity.runtime.defaults.directive.parse.max.depth, for
example) with no success - always get "not a valid reference".


Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

Re: How to access velocity properties in template

Posted by Nathan Bubna <nb...@gmail.com>.
it's not working for you because that's not what velocity.properties
is designed for.  it's meant for configuration of the Velocity engine,
not for access during its use.  you will have to retrieve those values
yourself and add them to your context, or else code up some sneaky
means to automate such access.

fyi, the toolbox support in VelocityTools includes the ability to
specify data constants in the toolbox config file that will always be
automatically available to your templates.  that may help.

On 6/23/05, bill.welch@ubs.com <bi...@ubs.com> wrote:
>  
> 
> I want to reference entries in velocity.properties in a template. For
> example, I'd like the template: 
> 
> Max depth is $directive.parse.max.depth 
> 
> to produce 
> 
> Max depth is 10 
> 
> I've tried a number of variations ( $parse.max.depth,
> $org.apache.velocity.runtime.defaults.directive.parse.max.depth,
> for example) with no success - always get "not a valid reference". 
> 
> Visit our website at http://www.ubs.com
> 
> This message contains confidential information and is intended only
> for the individual named.  If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail.  Please
> notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system.
> 
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses.  The sender therefore
> does not accept liability for any errors or omissions in the contents
> of this message which arise as a result of e-mail transmission.  If
> verification is required please request a hard-copy version.  This
> message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.
> 
> 
>

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