velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Captain Cid <captain_...@indiatimes.com>
Subject Re: checking if all variables are present
Date Tue, 28 Jul 2009 11:01:26 GMT

The scenario for me is an email webservice

It has many templates each having certain variables. Email service picks us
template and adds data provided to webservice. So it's kind of generic. I
dont know how many variables are there in template. All variables given to
web service will be used. But email should not be sent if any data is
missing. So how to tackle such situation !


Alexander-129 wrote:
> 
> Maybe this will help you [?] This way I always test if variable is not
> null
> 
> http://velocity.apache.org/engine/devel/user-guide.html#Conditionals
> .............
> 
> The *#if* directive in Velocity allows for text to be included when the
> web
> page is generated, on the conditional that the if statement is true. For
> example:
> 
> 
> #if( $foo )
>    <strong>Velocity!</strong>
> #end
> 
> The variable *$foo* is evaluated to determine whether it is true, which
> will
> happen under one of two circumstances: (i) *$foo* is a boolean
> (true/false)
> which has a true value, or (ii)* the value is not null*. Remember that the
> Velocity context only contains Objects, so when we say 'boolean', it will
> be
> represented as a Boolean (the class). This is true even for methods that
> return boolean - the introspection infrastructure will return a Boolean of
> the same logical value.
> 
> ............
> 
> 2009/7/28 Captain Cid <captain_cid@indiatimes.com>
> 
>>
>> I have a template containing some variables to be rendered from context.
>> Is there way by which i can know if all the variables are present in the
>> context, otherwise throw an error.
>> --
>> View this message in context:
>> http://www.nabble.com/checking-if-all-variables-are-present-tp24696207p24696207.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/checking-if-all-variables-are-present-tp24696207p24697071.html
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message