You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Rodney Schneider <ro...@actf.com.au> on 2002/11/28 01:32:17 UTC
2 macros with the same name allowed?
Hi all,
I have a really long macro called displayAllMessages which is used to
display nicely formatted messages to the user of my web application.
The macro takes two arguments; the messages to display and the color to
display them...
#macro (displayAllMessages $data $color)
<snip>
#end
I want to make the default color red, so I have created another macro
that calls the long macro...
#macro (displayAllMessages $data)
#displayAllMessages($data, "red")
#end
However, when I call the macro from one of my templates like so...
#displayAllMessages($data, "black")
... I get the attached error messages from Velocity.
Am I allowed to have two macros with the same name call each other in
Velocity? BTW, I'm using Velocity 1.2.
Regards,
-- Rodney
----------------------------------------------------
Wed Nov 27 18:05:10 GMT+11:00 2002 [error] Parser Exception:
screens/Upload.vm : org.apache.velocity.runtime.parser.ParseException:
Encountered "," at line 84, column 34.
Was expecting one of:
"[" ...
<RPAREN> ...
<WHITESPACE> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
<NUMBER_LITERAL> ...
<WORD> ...
<IDENTIFIER> ...
"{" ...
"}" ...
<DOT> ...
Wed Nov 27 18:05:10 GMT+11:00 2002 [error]
ResourceManager.getResource() parse exception:
org.apache.velocity.exception.ParseErrorException: Encountered "," at
line 84, column 34.
Was expecting one of:
"[" ...
<RPAREN> ...
<WHITESPACE> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
<NUMBER_LITERAL> ...
<WORD> ...
<IDENTIFIER> ...
"{" ...
"}" ...
<DOT> ...
Wed Nov 27 18:05:10 GMT+11:00 2002 [error] VM #displayAllMessages:
error : too few arguments to macro. Wanted 2 got 1 -->
org.apache.velocity.runtime.resource.loader.FileResourceLoader
Wed Nov 27 18:05:10 GMT+11:00 2002 [error] VM error :
displayAllMessages. Null AST
----------------------------------------------------
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>