Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6
    • Component/s: Documentation
    • Labels:
      None

      Description

      ---------- Forwarded message ----------
      From: Luan Nguyen <luan.min.nguyen@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 <wglasshusain@gmail.com>
      Date: Tue, Oct 23, 2007 at 9:55 AM
      Subject: Re: Evaluate Section
      To: Velocity Developers List <dev@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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              wglass Will Glass-Husain
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: