PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3346

*** shadow/3346 Wed Aug 29 13:41:16 2001
--- shadow/3346.tmp.6154        Wed Aug 29 13:41:16 2001
***************
*** 0 ****
--- 1,61 ----
+ +============================================================================+
+ | Passing Integer to velocimacro with formal notation does not work          |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 3346                        Product: Velocity                |
+ |       Status: NEW                         Version: 1.1                     |
+ |   Resolution:                            Platform: Sun                     |
+ |     Severity: Minor                    OS/Version: Solaris                 |
+ |     Priority: Other                     Component: Source                  |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: [EMAIL PROTECTED]                              |
+ |  Reported By: [EMAIL PROTECTED]                                        |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ 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.

Reply via email to