Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-876

Support a Configurable EL within ${{...}} also $!{{...}} tags

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.7
    • Fix Version/s: 2.1.x
    • Component/s: Engine
    • Labels:
      None

      Description

      Since Velocity2 is a Major version, why not start to support some new features?

      As of Velocity 1.x you can use ${ name } to refer to object "name" in the context, or use $!

      { name }

      if you want "" for null values.

      How about using ${{ el-expression }} to evaluate and output the given "el-expression" in a configured el-engine with the current velocity context, same should hold for $!{{ el-expression }}.

      Some possible engines would be :
      commons-el, commons-jexl, ognl, mvel

      if using el/jexl ${{ name }} would be mostly the same as ${ name }.

      usage cases:

      the simple ${{ ... }} would allow more complicated expressions than present in the plain engine, especially if we look at the jexl2/3 features

      #if( ${{ ... }} ) – would improve the boolean issue because the el could be used to wrap in "a?x:y"

      architecture:

      thru api abstraction, almost any el could be plugged in ( even groovy.eval or jsr223 )

      core engine could ship with the api and el or jexl as the reference impl, other bindings would be optional jars with thier own deps.

      brain storming:

      how about supporting non-outputting el/jsr223 between #{{ ... #}} tags, like:

      ------
      #{{ /* jexl code */
      var = [ 1,2,3,4,5,6,7 ];
      #}}
      #foreach( $n in $var )
      $n
      #end
      ------

        Attachments

          Activity

            People

            • Assignee:
              claude Claude Brisson
              Reporter:
              terefang Terefang Verigorn
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: