velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Integers and numbers in a comparison expression
Date Sat, 14 Jul 2001 04:09:14 GMT
Tal Dayan wrote:
> 
> > > The condition failed even though $num was higher than 7.
> > >
> > > Why not to throw an exception if the type of $num is invalid for
> > > the expression ?
> >
> > We could - we already log it.  An exception might be the way to go...
> 
> Oh, there is a log, I was not aware of it. Where is it found ? We are using
> the Velcoty app class and don't have any special configuration for the log,
> we
> are just configuring the the template loaders.

Oh, yes, there is a good log (so I think anyway).  The default log is
placed in the 'current directory' - if you are not paying attention in a
webapp, that will be the directory you start tomcat (or whatever) from
:)

See the servlet_example2 on how to ensure the velocity.log is placed in
your webapp.  Currently it goes into the root of your webapp (which
isn't so great...), but it still a good example..

And yes, teh log messages are rather complete and descriptive.

> 
> > > Also, without knowing much of the Velocity code, it looks to me that
> > > it would not be that difficult to convert a String value "134" to
> > > an integer when a integer value is required in the expression.
> > For example,
> > > one can write a generic method getIntegerValue(Object)->int that gets
> > > String, Long, Float, etc and converts then to an int. If the type
> > > of Object is invalid or the value does not represent an valid
> > numeric value
> > > than it can throw an exception. Am I missing something ?
> >
> > No - we've gone over this a few times. It is easy to do, but we wanted
> > to keep things simple.
> 
> Do you mean simple implementation or simple to the designer that
> use the template ? For the user, the ability to use strings in the
> expression will
> be simpler IMHO.
> 
> Tal

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Mime
View raw message