You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Will Glass-Husain (JIRA)" <de...@velocity.apache.org> on 2008/07/14 01:39:31 UTC

[jira] Created: (VELOCITY-603) improvate #evaluate example

improvate #evaluate example
---------------------------

                 Key: VELOCITY-603
                 URL: https://issues.apache.org/jira/browse/VELOCITY-603
             Project: Velocity
          Issue Type: Improvement
          Components: Documentation
            Reporter: Will Glass-Husain
            Priority: Minor
             Fix For: 1.6



---------- Forwarded message ----------
From: Luan Nguyen <lu...@gmail.com>
Date: Mon, Oct 22, 2007 at 8:56 PM
Subject: Evaluate Section
To: dev@velocity.apache.org


Hello,In the Evaluate section, there are two different variables: $source1
and $source.  How can it display "abc" when $source is never defined?

Evaluate

The *#evaluate* directive can be used to dynamically evaluate VTL. This
allows the template to evaluate a string that is created at render time.
Such a string might be used to internationalize the template or to include
parts of a template from a database.

The example below will display abc.

#set($source1 = "abc")
#set($select = "1")
#set($dynamicsource = "$source$select")
#evaluate($dynamicsource)




---------- Forwarded message ----------
From: Will Glass-Husain <wg...@gmail.com>
Date: Tue, Oct 23, 2007 at 9:55 AM
Subject: Re: Evaluate Section
To: Velocity Developers List <de...@velocity.apache.org>


That's a good point though.  Perhaps the example should use concatenation to be clearer. The single quotes prevent evaluation.

#set($dynamicsource = '$source' + "$select")

WILL

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (VELOCITY-603) improvate #evaluate example

Posted by "Nathan Bubna (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-603?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Bubna resolved VELOCITY-603.
-----------------------------------

    Resolution: Fixed

> improvate #evaluate example
> ---------------------------
>
>                 Key: VELOCITY-603
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-603
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Documentation
>            Reporter: Will Glass-Husain
>            Priority: Minor
>             Fix For: 1.6
>
>
> ---------- Forwarded message ----------
> From: Luan Nguyen <lu...@gmail.com>
> Date: Mon, Oct 22, 2007 at 8:56 PM
> Subject: Evaluate Section
> To: dev@velocity.apache.org
> Hello,In the Evaluate section, there are two different variables: $source1
> and $source.  How can it display "abc" when $source is never defined?
> Evaluate
> The *#evaluate* directive can be used to dynamically evaluate VTL. This
> allows the template to evaluate a string that is created at render time.
> Such a string might be used to internationalize the template or to include
> parts of a template from a database.
> The example below will display abc.
> #set($source1 = "abc")
> #set($select = "1")
> #set($dynamicsource = "$source$select")
> #evaluate($dynamicsource)
> ---------- Forwarded message ----------
> From: Will Glass-Husain <wg...@gmail.com>
> Date: Tue, Oct 23, 2007 at 9:55 AM
> Subject: Re: Evaluate Section
> To: Velocity Developers List <de...@velocity.apache.org>
> That's a good point though.  Perhaps the example should use concatenation to be clearer. The single quotes prevent evaluation.
> #set($dynamicsource = '$source' + "$select")
> WILL

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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