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: calling setProperty(float) not possible ?
Date Thu, 12 Jul 2001 01:51:43 GMT
Will Glass-Husain wrote:
> 
> Hi,
> 
> I'm a new Velocity user and am in the middle of developing some methods.
> Could you please clarify what datatypes are supported?

They aren't formally types, really.

Velocity will recognize as arguments to directives, velocimacros and the
RHS of #set() : 

integers -  1,2, 127  - #set($foo = 2 )
strings  -  'foo' or "foo"  (more later)   - $ref.method("hello")
boolean  -  true and false (not in quotes) - #woogie( true )
'range' - [ 1..10] (which is an ArrayList) -  #foreach($i in [1..10] )
'object array' - ["a","b","c"] (also ArrayList) - #set($foo = [
"a","b"] )

and I think that's it :)

Note that they have to be used as an arg to/within a directive or VM. 
Otherwise, they are 'schmoo', and Velocity treats them as plain text.

With strings, '$foo' is handled literally, "$foo" is actually
'rendered'.  So you can get away with all sorts of wacky things like

#set($list = "#foreach($i in [1..10]) $i, #end" )

if you are so diabolically inclined.

geir


-- 
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