Just to make sure this is clear,
We've implemented a patch and uploaded it to source code that has the
behavior Jack expects. In the meantime the behavior is really not very
useful.
Eventually this will get released. Or, if you need it now, use the latest
(unreleased source code).
Best,
WILL
----- Original Message -----
From: "Simon Christian" <[EMAIL PROTECTED]>
To: "Velocity Users List" <[email protected]>
Sent: Wednesday, June 01, 2005 1:26 PM
Subject: Re: No conditional #stop? / Validating that a parameter was passed
in code
Hi Jack,
You're dead right that it's not intended for that kind of use, it
actually terminates the execution of the template engine:
http://jakarta.apache.org/velocity/user-guide.html#Stop
The easy way to test if a 'parameter' is in the context is simply:
#if( $var )
or to test the opposite:
#if( ! $var )
If you wanted to include it in a macro similar to your original one,
something like the following might be appropriate:
#macro( test $var $varName )
#if( ! $var )
$varName is required!
#end
#end
- simon
On 1 Jun 2005, at 20:08, Jack Holt wrote:
Correct me if I am wrong, but it appears that #stop is not intended to
be used conditionally.
I saw this behavior when trying to write the following macro:
#macro(test $p $n)
#if($!p == "")
$n is required
#stop
#end
#end
#test($var "var")
I tried the above code in VeloGUI and noticed that velocity throws a
ParseErrorException with a message of Encountered "EOF" at line 4,
column 17
Am I right about this and (on a separate subject) is there a better
way to validate that a parameter was passed to a Velocity template
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]