Velocity
  1. Velocity
  2. VELOCITY-756

New notation for replacing null values with a specified string

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None

      Description

      If I have a variable $foo and it is null, I have the option of using the silent notation $!foo for not writing it. But often when genrating HTML pages I want to express that the values is missing, e.g. by a "-". That means that I have to write my code like this:

      #if($foo)
      $foo
      #else
      -
      #end

      Wouldn't it be great if there were a new option like $?foo (or whatever chararter would be suitable instead of "?") that would print the variable $foo if it was not null and otherwise print a predefined character like "-".

      /Ludwig

        Activity

        Ludwig Magnusson created issue -
        Jarkko Viinamäki made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]
        Mark Thomas made changes -
        Workflow jira [ 12501134 ] Default workflow, editable Closed status [ 12551722 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551722 ] jira [ 12552172 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Ludwig Magnusson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development