velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeich...@optonline.net
Subject Re: Ifnotnull
Date Fri, 06 May 2005 20:58:59 GMT
I like velocity very much, but I do not like its handling of null in general.  I do not want
to have to put a isNull check into every object being checked.  This at least seems a somewhat
straight forward directive.   I am not sure how efficient it is in comparison to the other
methods of checking and efficiency is important always.

In terms of configuring,  I have very recent Velocity and Velocity Tools from Subversion.
 Besides that, all I did was do what the link directed me to do which was to put in those
two properties in the velocity.properties file.

Should I do something else?  If so maybe the document should be updated?

Also maybe you can mention something on performance and whether this is a good way to go about
it all.  There were like five ways mentioned.

JohnE





----- Original Message -----
From: Shinobu Kawai <shinobu.kawai@gmail.com>
Date: Friday, May 6, 2005 2:40 pm
Subject: Re: Ifnotnull

> Hi jeichels,
> 
> > I had previously upgraded to 1.5-dev and things are working well 
> with the one email templating thing I had found help here on.
> > 
> > Since the upgrade, however, I seem to be getting some RHS of 
> #set statement is null. things i don't remember getting before.
> > 
> > I explored a bit and found:  http://wiki.apache.org/jakarta-
> velocity/CheckingForNull> 
> > I added these to my velocity property file:
> >       userdirective = 
> org.apache.velocity.tools.generic.directive.Ifnull>       
> userdirective = org.apache.velocity.tools.generic.directive.Ifnotnull
> 
> ## Wow!  First person I've heard using it!
> 
> > And changed my template code as follows:
> >         #ifnotnull( $form )
> >             #set ($attr = $form.getBean())
> >         #end
> > 
> > And get this error:
> > 
> > Encountered "#end\r\n" at line 3, column 1. Was expecting one 
> of: "(" ... ... ... ... "\\\\" ... "\\" ... ... ... "*#" ... "*#" 
> ... ... ... ... ... ... ... ... ... ... ... "{" ... "}" ...
> > 
> > org.apache.velocity.exception.ParseErrorException: Encountered 
> "#end\r\n" at line 3, column 1.
> 
> The error suggests that you aren't configuring the directive
> correctly.  Have you added it to your codebase/classpath?
> 
> Best regards,
> -- Shinobu
> 
> --
> Shinobu Kawai <shinobu.kawai@gmail.com>
> 
> -------------------------------------------------------------------
> --
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 


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


Mime
View raw message