You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Henning Schmiedehausen (JIRA)" <de...@velocity.apache.org> on 2007/03/08 01:10:29 UTC
[jira] Closed: (VELOCITY-13) Passing Integer to velocimacro with
formal notation does not work
[ https://issues.apache.org/jira/browse/VELOCITY-13?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henning Schmiedehausen closed VELOCITY-13.
------------------------------------------
> Passing Integer to velocimacro with formal notation does not work
> -----------------------------------------------------------------
>
> Key: VELOCITY-13
> URL: https://issues.apache.org/jira/browse/VELOCITY-13
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.1
> Environment: Operating System: Solaris
> Platform: Sun
> Reporter: peterwlynch
> Assigned To: Velocity-Dev List
> Priority: Minor
>
> The velocity user's guide states:
> --------8<---------------------
> Velocimacros can take as arguments any of the following VTL elements :
> Reference : anything that starts with '$'
> String literal : something like "$foo" or 'hello'
> Number literal : 1, 2 etc
> IntegerRange : [ 1..2] or [$foo .. $bar]
> ObjectArray : [ "a", "b", "c"]
> boolean value true
> boolean value false
> "
> ----------8<---------------------
> So I constructed the following macro:
> #macro(getIcon $name $num)
> ## int gets converted to string when passed
> #if ($num > 0)
> icon-${name}-on.gif
> #else
> icon-${name}-off.gif
> #end
> #end
> ... and called it like this:
> #getIcon( 'mail' ${numMail} )
> ... where $numMail was an Integer object with a value greater than zero
> in the macro, it always thought $num was null.
> until I did this:
> #getIcon( 'mail' $numMail )
> .. then it worked.
> The formal notation didn't work, even though the doc says:
> " Reference : anything that starts with '$' "
> Either the doc should clarify or the behaviour should be fixed to include
> formal notation.
--
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