How to check for null in velocity
for eg. I load a class in the context Class:: car
#if ($car.getFuel() = null ?? )
This does not work.
Thx
_
The happening world of BPO! Know all that you need to know!
http://www.bpowatchindia.com/msn
Hi,
I am trying to use a SAX parser in Velocity context and I need to do the
following
#set($temp = "$root.getRootElement().getChild("email").getText() )
But it throws
org.apache.velocity.exception.ParseErrorException: Encountered "email"
Any suggestions.
Thx
_
The condition is evaluated to determine if it's a boolean (true/false)
or if it's not null.
#if ($car.fuel)
...
#end
Regards
Edgar
Check http://jakarta.apache.org/velocity/user-guide.html#Conditionals
THE ULTIMATE SUBBIAH wrote:
How to check for null in velocity
for eg. I load a class in
On Thu, 2004-12-02 at 12:48, Subbiah Raman wrote:
> Hi,
> I am trying to use a SAX parser in Velocity context and I need to do the
> following
>
> #set($temp = "$root.getRootElement().getChild("email").getText() )
>
> But it throws
> org.apache.velocity.exception.ParseErrorException: Encountered
Hi SUBBIAH,
> How to check for null in velocity
> for eg. I load a class in the context Class:: car
>
> #if ($car.getFuel() = null ?? )
You can use NullTool
http://wiki.apache.org/jakarta-velocity/NullTool
#if ($null.isNull($car.fuel))
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <[EMAI
Subbiah Raman <[EMAIL PROTECTED]> wrote:
> I am trying to use a SAX parser in Velocity context and I need to do the
> following
>
> #set($temp = "$root.getRootElement().getChild("email").getText() )
>
> But it throws
> org.apache.velocity.exception.ParseErrorException: Encountered "email"
In ad
Thank you all for your input, it clears some parts of the quetsion.
As you might have quest I have just started using velocity.(a week)
My generic question on VELOCITY is this.
1. I see velocity very similar to adding sessions in servlets and accessing
them in the jsp pages. Is this correct ?
2
Hi,
I've following the instruction using the classload
by putting jarred vm file in the CLASSPATH. And the
loader cannot find it.
ps. I am using linux, and i checked the jar is in the
CLASSPATH. I am running the app in the eclipse. The
error message says it cannot locate the vm.
Can someone tell
I think you can also do something like this:
#if($car && $car == "")
That is, if $car is defined and has no value (ie, null)
- Original Message -
From: Shinobu Kawai
To: Velocity Users List
Sent: Thursday, December 02, 2004 10:56 AM
Subject: Re: null in velocity
Hi SUBBIA
I find #if( "$!car" == "" ) to be the most reliable null test.
On Thu, 2 Dec 2004 14:47:29 -0500, Terry Steichen <[EMAIL PROTECTED]> wrote:
> I think you can also do something like this:
>
> #if($car && $car == "")
>
> That is, if $car is defined and has no value (ie, null)
>
>
> - Origi
If you are doing a test for java 'null' value, then
#if ($car.fuel)
will return true if $car.fuel is NOT a java null value.
If you are checking for an empty string, then use the String
comparison.
#if ($car.fuel=="")
If you want to check for both:
#if ($!car.fuel=="")
I have a general purpose t
Hi all,
I thought it's about time the null question go to the FAQ. I'm trying
to thinking of a way to summarize it.
Problem: I want to check for null, something like this:
#if ($car.fuel == null)
Approach 1: Use the fact that null is evaluated as a false conditional.
cf. http://jakarta
Hi yao,
> I've following the instruction using the classload
> by putting jarred vm file in the CLASSPATH. And the
> loader cannot find it.
> ps. I am using linux, and i checked the jar is in the
> CLASSPATH. I am running the app in the eclipse. The
> error message says it cannot locate the vm.
Hi Subbiah,
> My generic question on VELOCITY is this.
> 1. I see velocity very similar to adding sessions in servlets and accessing
> them in the jsp pages. Is this correct ?
In a way, yes. In Velocity, you put stuff in the Context, and then you
can access them from the template. In additio
14 matches
Mail list logo