null in velocity

2004-12-02 Thread THE ULTIMATE SUBBIAH
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

XML and velocity

2004-12-02 Thread Subbiah Raman
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 _

Re: null in velocity

2004-12-02 Thread Edgar Poce
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

Re: XML and velocity

2004-12-02 Thread Claude Brisson
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

Re: null in velocity

2004-12-02 Thread Shinobu Kawai
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

Re: XML and velocity

2004-12-02 Thread Mike Kienenberger
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

RE: XML and velocity

2004-12-02 Thread Subbiah
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

question about resource loader: class

2004-12-02 Thread yao fei
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

Re: null in velocity

2004-12-02 Thread Terry Steichen
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

Re: null in velocity

2004-12-02 Thread Nathan Bubna
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

Re: null in velocity

2004-12-02 Thread Barbara Baughman
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

[FAQ] How do you check for null?

2004-12-02 Thread Shinobu Kawai
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

Re: question about resource loader: class

2004-12-02 Thread Shinobu Kawai
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.

Re: XML and velocity

2004-12-02 Thread Shinobu Kawai
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